Commit Graph

58 Commits

Author SHA1 Message Date
Denis Zharkov f72aa78eec Fix libraries analysis for case of isReleaseCoroutines feature enabled
#KT-25466 In Progress
2018-07-19 16:19:04 +03:00
Pavel V. Talanov a8a490ea5a Test multifile facades in mpp projects 2018-06-06 21:04:00 +02:00
Pavel V. Talanov 8185b1bf02 Test accessing file facades from java in mpp project 2018-06-06 21:03:57 +02:00
Pavel V. Talanov dae8b12872 Mpp: fix production internals not visible from tests in platform modules
Caused by change in mpp resolve
Happened in platform modules that have expectedBy dependencies

#KT-24729 Fixed
2018-06-01 14:15:04 +02:00
Mikhail Glukhikh f8f3b1c6f1 Provide language version settings correctly for platform modules
So #KT-24546 Fixed
2018-05-24 16:40:52 +03:00
Alexander Udalov 712a796637 Fix MultiModuleHighlightingTestGenerated.testUseCorrectBuiltInsForCommonModule
Add dependency from a_jvm8 on stdlib. Otherwise, `getEmptyList` from
a_common was resolved to have an error return type
2018-05-02 16:56:54 +02:00
Nikolay Krasko 5216dfcc59 Add internal errors to test data in multi module tests
Tests started to fail after 82a21b3955.
2018-04-28 22:24:39 +03:00
Pavel V. Talanov 521357a22d Add tests for KT-20824, KT-23745, KT-23124, KT-20605, KT-23760
#KT-20824 Fixed
 #KT-23745 Fixed
 #KT-23124 Fixed
 #KT-20605 Fixed
 #KT-23760 Fixed
2018-04-20 20:00:12 +02:00
Pavel V. Talanov 94fe170b7b MPP: analyze platform sources with expectedBy common sources
This allows to emulate current compiler behaviour

Introduce CombinedModuleInfo which is a combination of several other modules intended to be analyzed together
2018-04-20 20:00:11 +02:00
Pavel V. Talanov 3949fc70c9 Adjust test data for previously ignored tests 2018-04-20 20:00:05 +02:00
Pavel V. Talanov 5ddb7c71d1 Mpp resolve: fix actual/expect declaration lookup
Previously we would look fo expect declaration in common dependencies
    as opposed to looking inside the module exclusively
2018-04-20 20:00:04 +02:00
Pavel V. Talanov cdb49511e6 Mpp highlighting test: make generated, adjust test data
Note: this spawns new test cases which were ignored previously
2018-04-20 20:00:02 +02:00
Alexander Udalov 0439abba46 Check that kotlin.stdlib is explicitly required in module-info
Writing a Jigsaw-modular Kotlin program which doesn't require
kotlin.stdlib doesn't make sense because it most likely will fail at
runtime, on access to anything from the standard library. Previously, we
checked that kotlin.stdlib was in the module graph, but that's not
enough, we should also check that the source module requires it.
'-Xallow-kotlin-package' can be used to disable the error.

Add a test checking that an indirect (transitive) dependency is also OK
2018-04-03 21:50:25 +02:00
Mikhail Glukhikh 442a89bc6c ModuleDescriptor now sees internals of its expected by #KT-15739 Fixed 2018-03-07 13:58:31 +03:00
Mikhail Glukhikh 3f500a1655 Add "expectedBy" to module descriptor and use it in checker
Now ExpectActualDeclarationChecker in IDE context
uses common module descriptors for relevant checks.
Compiler still uses own module instead (see comment in checker)
So #KT-21771 Fixed
2018-02-14 15:09:14 +03:00
Alexander Udalov 21e2a3c0b4 Load module annotations in IDE
#KT-22759 Fixed
2018-02-08 17:08:33 +01:00
Mikhail Glukhikh 8a3fed15f8 Report NO_ACTUAL_FOR_EXPECT etc. on relevant declaration
So #KT-20398 Fixed
2017-10-06 10:48:34 +03:00
Mikhail Glukhikh 5687fe6e39 Introduce ModuleDescriptor.findImplementingDescriptor() via facets
This function is now used instead of allImplementingCompatibleModules,
thus allowing it to be deleted together with allImplementingModules

So #KT-17369 Fixed
So #KT-17374 Fixed
May fix also some other MPP issues
2017-09-28 15:15:02 +03:00
Mikhail Glukhikh 848a80a266 Add test (with incorrect work yet) for KT-17374 2017-09-28 15:15:01 +03:00
Mikhail Glukhikh 390de737e7 Fix messages in some multi platform highlighting tests 2017-09-28 15:15:01 +03:00
Mikhail Glukhikh a18e9436a1 Migration to expect/actual: change diagnostics rendering 2017-09-16 19:47:40 +03:00
Stanislav Erokhin 2b186909d4 Migrate diagnostic names for header/impl 2017-09-15 18:29:29 +03:00
Mikhail Glukhikh 32cc619f15 Migration to expect/actual: fix multiplatform highlighting tests 2017-09-15 18:28:57 +03:00
Alexander Udalov f47093dc45 Allow to access unexported package of named module in unnamed module in IDE
#KT-19492 Fixed
2017-08-30 15:45:45 +03:00
Alexander Udalov 09c1115ff9 Report errors on usages of unnamed module from named modules in IDE
#KT-19493 Fixed
2017-08-30 15:45:45 +03:00
Alexander Udalov d1cff41ce0 Treat nested class of header class as header
Note that the quick fix to implement header class works incorrectly when
that class has nested classes at the moment; this should be fixed
separately

 #KT-15494 Fixed
 #KT-18573 Fixed
2017-08-25 15:40:37 +03:00
Alexander Udalov 9ecd04f628 Improve diagnostics on header/impl classes when scopes don't match
Try to report most of the errors on the actual members of the impl
class. In many cases, there's a 1:1 mapping of header to impl class
members, so the error "some members are not implemented" on the class
declaration itself is redundant. Exceptions include functions/properties
from supertypes (there may be no other place to report a signature
mismatch error in this case), functions/properties not marked with
'impl' (the checker is only run for declarations explicitly marked with
'impl') and default constructors (the checker is not run for them)

 #KT-18447 Fixed
2017-08-25 15:35:05 +03:00
Alexander Udalov 74ba0080b1 Improve header/impl mismatch diagnostic messages
Try to report most mismatch errors on the 'impl' declaration. Only
report a mismatch error on the 'header' declaration if no error would be
otherwise reported on any 'impl' declaration in the compilation unit.
Also render declaration kind in the message

 #KT-18447 In Progress
2017-08-25 15:35:05 +03:00
Pavel V. Talanov 6424b6760f Remove StorageComponentContainerContributor::onContainerComposed
Rename addDeclarations -> registerModuleComponents
Use it to provide SamWithReceiverResolver extensions instead

Post construction on container composition can be achieved
    but manually inserting injections where it seems appropriate
    is bug prone
This fixes a bug where SamWithReceiverPlugin extension was not registered
    for some containers in IDE which led to incorrect highlighting in IDE
Add IDE test for applying SamWithReceiver plugin

 #KT-18062 Fixed
2017-08-18 19:11:25 +03:00
Dmitry Jemerov bdbe134b60 Recreate module descriptors for affected modules only on a change 2017-08-09 13:26:09 +02:00
Mikhail Zarechenskiy 4d4c39939f Report full package FQ name in compilation errors related to visibility
#KT-18966 Fixed
2017-08-07 18:49:55 +03:00
Alexander Udalov e8a8bdc58e Add test on cyclicly dependent Java 9 modules 2017-07-06 13:01:12 +03:00
Alexander Udalov f8346d21c2 Check type alias expansion for Java 9 module accessibility
#KT-18598 In Progress
2017-06-29 15:59:57 +03:00
Alexander Udalov 8768500844 Fix incorrect behavior and refactor JvmModuleAccessibilityChecker
Previously we assumed that a symbol is accessible if its containing
package is exported by module-info.java. Which was obviously wrong and
could lead to a situation where a symbol would be incorrectly accessible
if a usage module has a dependency on the symbol's module in IDEA
project terms, but does not require it in its module-info.java

 #KT-18598 In Progress
2017-06-29 15:59:57 +03:00
Alexander Udalov e32880d9a3 Implement Java 9 module visibility checks
In this commit, only IDE tests are added, because we look for module
declarations in the IDE across the whole project, whereas in the
compiler we should do this on the module path only and that requires
separate work (KT-18599) which is done in the following commits.

(The change in Cache.kt is needed so that
JvmModuleAccessibilityChecker.ClassifierUsage, which is an inner class,
would be injected properly.)

 #KT-18598 In Progress
 #KT-18599 In Progress
2017-06-29 15:59:56 +03:00
Pavel V. Talanov 8fc953f529 Modules with different language levels can't be analyzed together
"Supports additional builtIn members" setting
    is basically adding members to some types
If we analyze them toghether other modules would leak types
    that have those members (or don't) into other modules scopes
    leading to code that has erroneous highlighting

See KT-17357

#KT-17357 Fixed
2017-05-22 17:42:21 +03:00
Pavel V. Talanov 55721e4f16 Test not creating resolvers for modules that have no relevant packages 2017-05-16 22:15:06 +03:00
Mikhail Glukhikh 0798e43524 Consider only source-compatible modules in allImplementingModules use-sites
So #KT-17400 Fixed
So #KT-15680 Fixed
So #KT-15660 Fixed
Likely also #KT-16838 Fixed
2017-05-02 19:01:31 +03:00
Mikhail Glukhikh 04f7ba95c5 Add module name to HEADER_WITHOUT_IMPLEMENTATION message 2017-05-02 14:17:20 +03:00
Alexander Udalov ea727ff3f0 Use header->impl mapping in HeaderImplDeclarationChecker.areCompatibleTypes
Construct a special TypeCheckingContext that is aware of the magic
behind the "impl typealias" that implements a "header class"

 #KT-16986 Fixed
2017-04-20 22:33:25 +03:00
Alexander Udalov 9a8dc14616 Do not add JS/JVM libraries to common library dependencies in LibraryDependenciesCache
Currently kotlin-stdlib-common doesn't have serialized built-ins inside,
so in a multiplatform project, it was possible that either JVM or JS
built-ins (depending on the order of entries in the project
configuration) were going to be used for the analysis of a common module
depending on kotlin-stdlib-common. This resulted, for example, in
additional built-in member calls (e.g. "List.stream()") being unresolved
in JVM modules when they used the List instance coming from the common
module (see the added test)
2017-04-18 22:58:56 +03:00
Alexander Udalov 7fe9b99087 Support different target platforms for modules in AnalyzerFacade
Instead of reusing the same AnalyzerFacade that is used for resolution
of a module to resolve its dependencies, analyze each dependency
module/library with a facade depending on its target platform. Introduce
and use CommonLibraryDetectionUtil in addition to
KotlinJavaScriptLibraryDetectionUtil, to detect common libraries (with
.kotlin_metadata files).

Note that before multi-platform projects, this was not needed because
there were only two platforms (JVM and JS), and JVM module had only JVM
modules/libraries as dependencies, JS module had only JS
modules/libraries as dependencies. Now, for example, a JVM module can
have a common module/library as a dependency, and it would be incorrect
to analyze that dependency with JvmAnalyzerFacade because that facade
does not know anything about .kotlin_metadata files.

The changes in Dsl.kt and KotlinCacheServiceImpl.kt are needed because
PsiElement.getJavaDescriptorResolver, called from some IDE code, started
to fail on a common module, because the container for a common module
does not have the JavaDescriptorResolver
2017-04-14 00:44:00 +03:00
Alexander Udalov 722687acd6 Refactor multiplatform test cases in MultiModuleHighlightingTest
Groupt multiplatform test cases in a nested class, get rid of duplicated
code, rename "header" -> "common" where it relates to the common module
2017-04-14 00:43:59 +03:00
Mikhail Glukhikh b0a333456e Platform header IDE annotation: do not report suppressed error #KT-15601 Fixed 2017-01-11 18:37:44 +03:00
Mikhail Glukhikh 76ee6d7712 Minor: multi-platform highlighting tests rename 2017-01-11 18:37:38 +03:00
Mikhail Glukhikh 5947d49dee Multi-platform fix: no more errors for top-level impl fun / val / var in IDE 2016-12-19 14:55:49 +03:00
Mikhail Glukhikh 3540bc008b Build fix: testPlatform3 from MultiModuleHighlightingTest 2016-12-15 11:07:33 +03:00
Mikhail Glukhikh 052a5033b5 PLATFORM_DECLARATION_WITHOUT_DEFINITION rendering changed (platform is included into diagnostic text now) 2016-12-13 19:06:08 +03:00
Mikhail Glukhikh 7649232f86 Platform header annotator: implementation + simple multi-platform highlighting tests #KT-14905 Fixed 2016-12-13 19:02:23 +03:00
Alexander Udalov 83000c50ff Remove quotes around visibility in invisible member diagnostic 2016-07-22 18:13:41 +03:00