Commit Graph

55503 Commits

Author SHA1 Message Date
Leonid Startsev 2488b40d52 Fix accidentally added comment which broke 183 bunch 2019-06-12 15:30:31 +03:00
Ting-Yuan Huang f07be024b7 JVM_IR: handle JvmDefault for bridges. 2019-06-12 07:43:45 +02:00
Leonid Startsev b78d84c120 Add some tests for kotlinx.serialization plugin:
- declaration checker
- bytecode listings
- JVM IR

Improve @Transient redundant reporting
2019-06-11 19:32:40 +03:00
Ilya Kirillov 2dd604cd70 New J2K, minor: remove unused declarations, fix typos 2019-06-11 18:16:06 +03:00
Ilya Kirillov b80f2c78a0 New J2K, minor: reformat code, optimize imports 2019-06-11 18:16:06 +03:00
Ilya Kirillov 59f66d5882 New J2K: split diagnostic based processing from inspection ones
Analysing file file with diagnostics on each step of post-processings is rather expensive operation so the inspection-like post-processings which don't require diagnostic information was separated from ones that need it

Related to #KT-31848
2019-06-11 18:16:06 +03:00
Dmitry Savvinov 2f8e83d6b9 Minor: regenerate tests 2019-06-11 18:11:44 +03:00
Alexander Udalov c67517cb2b JVM IR: use fast class reading mode in boxAgainstJava tests
annotationsViaActualTypeAliasFromBinary.kt is ignored because
ExpectActualRemover can't find actual for the expected constructor of
Anno now, because `ExpectedActualResolver.findActualForExpected`
incorrectly filters out actual declarations without any source file, and
Java classes loaded in the fast mode don't have any source files.

This will need to be fixed separately, probably by making
ExpectedActualResolver look for the actual class of an expected class
member first (with source file-based filtering), and then
unconditionally locating the corresponding member there
2019-06-11 15:26:07 +02:00
Alexander Udalov c6d61346dd Avoid compiling Java files twice in boxAgainstJava tests
After b602c08773, this test started to put all .java files to the
dependencies when compiling .kt files, _in addition_ to the already
compiled class files from those Java sources. This is incorrect because
the test should actually check how Kotlin compiles _against_ Java
binaries. The other behavior (compiling against Java sources) is already
supported and used in normal box tests with .java sources.

However, we can't simply filter out all .java files before calling
`super.doMultiFileTest` because many of those contain directives
(WITH_RUNTIME, FULL_JDK, etc.) and we should load them in
`CodegenTestCase.compile`. As a workaround, remove '.java' file
extension to prevent their compilation but still be able to resolve
directives.
2019-06-11 15:26:07 +02:00
Vasily Levchenko e3d2419beb [tests][codegen][coroutines] disable test simpleSuspendCallableReference for NATIVE too. 2019-06-11 12:07:58 +03:00
Dmitry Savvinov 32a102a99d Fix bug in ExpectedActualResolver
'getContributedDescriptors' isn't obliged to apply filters, inlcuding
kindFilter, and may return declarations of different kind, so we have to
call 'filterIsInstance' explicitly
2019-06-11 11:07:01 +03:00
Ilya Kirillov 3854a323fa New J2K: do not ignore errors in new j2k tests comparison 2019-06-11 10:37:26 +03:00
Ilya Kirillov ce569ca6e0 New J2K: remove static modifier for the case when member is converted without containing class 2019-06-11 10:37:25 +03:00
Ilya Kirillov 9929dba74d New J2K: fix ConcurrentModificationException while analysing implicit initializers 2019-06-11 10:35:32 +03:00
Ilya Kirillov 184825d59d New J2K: remove open modifier for top level functions on post-processing
#KT-31678 fixed
2019-06-11 10:35:32 +03:00
Ilya Kirillov 6d3967d922 New J2K: add tests for some obsolete J2K issues 2019-06-11 10:35:31 +03:00
Ilya Kirillov 04fe51b0aa New J2K: use default test file directives for choosing SDK in tests instead of by filename approach 2019-06-11 10:35:31 +03:00
Ilya Kirillov 8375a12733 New J2K: properly remove redundant modifiers in post-processing as #KT-30804 is fixed 2019-06-11 10:35:31 +03:00
Ilya Kirillov 2aa20d003d New J2K: convert vararg type parameter Java length call to Kotlin size call 2019-06-11 10:35:30 +03:00
Ilya Kirillov b211ae1070 New J2K: correctly convert Kotlin function type 2019-06-11 10:35:30 +03:00
Ilya Kirillov a2b832e5be New J2K: correctly convert Java String type to Kotlin String 2019-06-11 10:35:30 +03:00
Ilya Kirillov 0fc0f99acb New J2K: do not commit document after each inspection in post-processing
Related to #KT-31848
2019-06-11 10:35:29 +03:00
Ilya Kirillov 110611d690 New J2K: group post-processings to named groups 2019-06-11 10:35:29 +03:00
Ilya Kirillov cacb4ed9f3 New J2K: correctly handle field symbol in EnumFieldAccessConversion 2019-06-11 10:35:29 +03:00
Ilya Kirillov ca34c55dde New J2K: do not call shortenClassReferences on AST building for addTypeArguments 2019-06-11 10:35:28 +03:00
Ilya Kirillov 417717914d New J2K: use IDEA indexes for resolving
Related to #KT-31848
2019-06-11 10:35:28 +03:00
Ilya Kirillov 5f8b5efd66 New J2K: do not find import usages in AST building phase
It is a rather heavy operation and it increases conversion time
Related to #KT-31848
2019-06-11 10:34:34 +03:00
Sergey Rostov d0e3ab1beb Gradle, tests runner: don't use separate thread to parse process output
Or --scan will fail (see KT-31891 for more details).
To do it in same thread we should parse output on output stream calls.
TCServiceMessageOutputStreamHandler will do that.

Also, all new lines now preserved, so TCServiceMessagesClient should
ignore new lines after messages. New ignoreLineEndingAfterMessage setting
will do that.

#KT-31891 Fixed
2019-06-11 09:18:27 +03:00
Sergey Rostov 84b87a22e6 Gradle, tests runner: use OperationIdentifier object as id (not long)
#KT-31448 Fixed
#KT-30691 Fixed
2019-06-11 09:18:26 +03:00
Mikhail Zarechenskiy 991e60c9e4 Add tests for obsolete issues
#KT-31784 Obsolete
 #KT-31757 Obsolete
2019-06-10 17:37:52 +03:00
Leonid Startsev 414c116d93 Fix too strict serializer lookup for generic type parameters 2019-06-10 16:49:19 +03:00
Igor Chevdar acf9670306 Fixed bug with file descriptors leakage 2019-06-10 13:41:57 +03:00
Igor Chevdar 3e8f3e6f00 [Klib] Split up IR header tables onto three parts
There was one monolith protobuf at irHeader.knd, it was
split up onto 4 parts due to performance issues:
  - a small irHeader with some basic info about a module
  - symbols table
  - types table
  - strings table
These 3 tables are then mmapped and accessed by index.
2019-06-10 13:41:57 +03:00
Alexander Gorshenev 5faccaa49e Got rid of delegation in library impl hierarchy 2019-06-10 13:41:57 +03:00
Dmitry Savvinov 65a6b08fd3 Fix lines joining of TextDiagnostics on Windows
The initial assumption were that inside compiler and test framework all
line breaks are normalized, because we read text files only through IDEA
utils (which do normalization).

The mistake was that 'StringBuilder.appendln()' appends
'System.lineSeparator()' as well, so it's not enough to only check that
we don't load files from disk without normalizing whitespaces.

Note that using 'it.replace(System.lineSeparator(), ...)' would be
incorrect too, because actually we have strings with two kinds of line
breaks here (normalized and not normalized), so we're looking for both
via simple regex.
2019-06-10 13:34:28 +03:00
Dmitry Savvinov 8df759b05c [Expect/Actual] Adjust IdeaModuleStructureOracle to old IDE Resolve
The main issue is that we have CombinedModuleInfo in old IDE Resolve,
which essentially merges platfor-modules together with its
dependsOn-parents. It conceals real module structure, which is fine for
practically all clients except for ExpectedActualDeclarationChecker.

In particular, it is nearly impossible to check expect/actual via
ModuleDescriptors, because you'll always get one and the same
'merged'-module descriptor.

So, this commit rewrites IdeaModuleStructureOracle in the following way:
- use ModuleInfos instead of ModuleDescriptor, as they allow more
fine-grained way to work with modules
- use 'unwrapModuleSourceInfo' in seemingly random places in order to
get real, non-merged moduleInfos
- carefully convert them back to ModuleDescriptors, because EADC work
with descriptors

This is still not an ideal solution. In particular, last step is flawed:
conversion back to ModuleDescriptors will always return merged
moduleDescriptor for platform-modules. There's no easy way to fix that
except for removing CombinedModuleInfo altogether, so we leave it as
known issue.

Also, there are some weird changes in testdata (again, because sometimes
we see several modules merged together), but they are mostly confusing
rather than plain incorrect.
2019-06-10 13:34:28 +03:00
Dmitry Savvinov 54b8f9da28 [Expect/Actual] Add testdata on hierarchical expect/actual matching 2019-06-10 13:34:27 +03:00
Dmitry Savvinov cac326bf4a [Expect/Actual] Adjust old testdata after changes in expect/actual
matching

This commit makes several changes in testdata:

- compiler multiplatform tests now contain newly introduced diagnostics
about AMBIGIOUTS_ACTUALS
- MultiModuleHighlighitng tests now contain proper reports about
ACTUAL_MISSING:
  - ACTUAL_MISSING should be indeed reported in them, because those
  tests don't contain dependsOn edges, only usual intermodule
  dependencies
  - This error wasn't reported here because expect/actual diagnostics in
  common module used to be reported by PlatformExpectedAnnotator, which
  had a bit flawed logic for deremining common-modules: it checked for
  presence of implementing modules. In those tests, common module has no
  implementing modules, so Annotator was returning silently
  Note that such configurations (common module without implementing
  modules) are almost impossible in real-life projects
  - After removal of PlatformExpectedAnnotator, we use
  ExpectedActualDeclarationChecker in common modules, which launches all
  checks properly
- some QuickFixMultuModuleTests now contain proper reports about
ACTUAL_MISSING. This change is also connected with
PlatformExpectedAnnotator, but now for different reason:
  - QuickFixMultiModuleTest used to check for errors in file by running
  'analyzeWithAllCompilerChecks' and inspecting returned BindingTrace.
  For common modules, there were no diagnostics about expect/actuals in
  that trace, because there were no ExpectedActualDeclarationChecker
  (and PlatformExpectedAnnotator was reporting diagnostics in ad hoc
  trace).
  - Again, now we inject EADC in common modules properly, so we see
  those errors in trace and report them in test
2019-06-10 13:34:27 +03:00
Dmitry Savvinov 174ef56991 [Expect/Actual] Remove PlatformExpectedAnnotator 2019-06-10 13:34:27 +03:00
Dmitry Savvinov 29beed9b21 [Expect/Actual] Support matching of expect/actual in hierarchical MPP 2019-06-10 13:34:27 +03:00
Dmitry Savvinov 4e12701145 [Expect/Actual] Introduce ModuleStructureOracle 2019-06-10 13:34:27 +03:00
Dmitry Savvinov 0915f0c78a [Expect/Actual] Let DI instantiate ExpectedActualDeclarationChecker
Inject it instead of calling constructor manually and passing instance
directly into the container. This allows to accept some components in
constructor of ExpectedActualDeclarationChecker
2019-06-10 13:34:27 +03:00
Dmitry Savvinov 44cbdd142b [Expect/Actual] Collect expectedBy modules correctly in case of HMPP 2019-06-10 13:34:27 +03:00
Dmitry Savvinov de2944ff43 [Misc] Fix errors checking in QuickFixMultiModuleTest
This test was checking errors *before* applying action, rather than
*after*, like all other QuickFix-tests do. This commit moves
errors-check after performing quick-fix action, and changes testdata:

- for most tests errors are simply gone (as quickfix usually fixes that
error)
- also, for implementMembersInActualClassNoExpectMember we add
'DISABLE-ERROR', similarly to
implementMembersInImplClassNonImplInheritor. This is needed because
'Implement Members'-fix created 'TODO'-calls, which are not resolved in
those tests due to the lack of stdlib. Previously, there were no errors
in this test exactly because file was checked *before* applying quickfix
(i.e. when there were no 'TODO()' in file)
2019-06-10 13:34:27 +03:00
Dmitry Savvinov d458821565 [Misc] Get rid of IdePlatformKind.IDE_KINDS_BY_COMPILER_PLATFORM
It works incorrectly for cases of non-trivial common platforms (works
fine for 'JVM/JS/Native', but doesn't work for 'JVM/JS')
2019-06-10 13:34:27 +03:00
Dmitry Savvinov fbbd1a268b [Misc] Minor: generalize TypeUtils.closure 2019-06-10 13:34:27 +03:00
Dmitry Savvinov 935c9fce17 [Misc] Extract method in ExpectedActualDeclarationChecker for clarity 2019-06-10 13:34:27 +03:00
Mikhail Glukhikh 309708f433 Do not visit FirBlock type twice 2019-06-10 11:03:10 +03:00
Simon Ogorodnik df9479b607 Cache declared member scope 2019-06-10 11:03:09 +03:00
Simon Ogorodnik 3aadf58354 Fix leak of BodyResolveTransformer due to inference components capture 2019-06-10 11:03:09 +03:00