Commit Graph

59162 Commits

Author SHA1 Message Date
Alexander Udalov 0daab88f97 JVM IR: make RemoveInlinedDeclarations a final module phase
Code in inline lambdas can call multifile part members. These calls are
replaced in GenerateMultifileFacades with the call to the facade member.
Previously this didn't happen though because the lambda body was removed
before the GenerateMultifileFacades phase, which led to
IllegalAccessError in the -Xmultifile-parts-inherit mode (because the
part class is package private in another package).
2019-11-18 18:58:41 +01:00
Alexander Udalov cdb7703947 JVM IR: fix VerifyError on annotated annotation properties
The problem was that we tried to generate an `$annotations` method for a
property declared in an annotation class. That method is final and has a
body, which is not allowed in annotation classes. Now we're generating
this method in the separate `$DefaultImpls` class as for properties in
interfaces.

Note that the added test still doesn't find any annotations because the
proper support is needed in reflection (KT-22463). Currently it only
checks that no VerifyError happens.
2019-11-18 18:58:41 +01:00
Alexander Udalov 994d4e081b JVM IR: fix names of monitorenter/monitorexit intrinsics
Since they're "illegally" accessed from another file in stdlib,
accessors are generated for them, and the calls go through these
accessors
2019-11-18 18:58:41 +01:00
Alexander Udalov f47b67781d JVM IR: fix containing declaration for top level members in wrapped descriptors
In addition to fixing getContainingDeclaration, change origin of
multifile facades to FILE_CLASS since the corresponding class descriptor
should also be skipped when computing containing declaration. This fixes
the problem with internal function calls in -Xmultifile-parts-inherit
mode (previously we incorrectly mangled the function name in
MethodSignatureMapper), and also fixes coroutine intrinsic calls when
compiling kotlin-stdlib with JVM IR. In the latter case, all intrinsics
(such as isBuiltInSuspendCoroutineUninterceptedOrReturn) are present in
sources, and were previously not detected as intrinsics by the code in
`generateInlineIntrinsic` because the FQ name didn't match: it had an
additional component for the file class name.
2019-11-18 18:58:41 +01:00
Alexander Udalov 59af967292 JVM IR: support suspend inline functions in -Xmultifile-parts-inherit mode
Support in the normal (without -Xmultifile-parts-inherit) mode is a bit
more complicated, see the added test.
2019-11-18 18:58:40 +01:00
Alexander Udalov 6f5aa58338 JVM IR: support -Xmultifile-parts-inherit mode 2019-11-18 18:58:40 +01:00
Alexander Udalov 3b6b3c7e66 JVM IR: minor, don't use symbols for maps of multifile members
To simplify usage of these maps at call sites
2019-11-18 18:58:40 +01:00
pyos 9182f2c796 IR: don't attempt to move defaults to actual in another module
May happen when a function in an `expect` class is aliased through an
`actual typealias`; the matching declaration is filtered out in
`ExpectedActualResolver.findActualForExpected` as it has no source.
2019-11-18 18:41:21 +01:00
pyos 1bc48c3df9 IR: copy annotations when making lateinit fields nullable 2019-11-18 18:35:15 +01:00
Alexey Trilis 4f56b1a960 Add support for Touch API in JS Stdlib
#KT-34948 fixed
#KT-21445 fixed
2019-11-18 19:44:03 +03:00
Vyacheslav Gerasimov 2dfa6c360b Fix version range for Idea 191 plugin
#KT-34385
2019-11-18 18:49:40 +03:00
Svyatoslav Kuzmich a46e970f47 [JS] Remove kotlin-test-js build from JPS
kotlin-test-js is also built by JS IR backend
JS IR backend does not support JPS yet
2019-11-18 15:31:12 +03:00
Svyatoslav Kuzmich c8e5b2f2f8 [KLIB] Add error message when failed to resolve library 2019-11-18 15:31:12 +03:00
Pavel Kirpichenkov 3e8c15c62a Introduce component for caching missing supertypes
Profiling has shown, that supertype hierarchy scan for all calls has considerable
performance cost. However, missing supertypes may be calculated only once per
descriptor which would help avoiding multiple supertype hierarchy scans for
resolved calls from the same class. New memoizer is injected into call completers
and checker contexts and then used for retrieving missing super classifiers.

#KT-19234 Fixed
2019-11-18 12:06:41 +03:00
Pavel Kirpichenkov 4b405c6c0f Supply kotlin mock JDK to relevant test runners
Default mock JDK from IDEA 193, "wins" mock JDK from kotlin in some tests.
In script configuration test this breaks resolution of java declarations from script environment.
Overriding getTestProjectJdk replaces default test project JDK with kotlin mock JDK.
Configuration in AbstractMultiFileHighlightingTest was updated similarly to fix test failures.
2019-11-18 12:06:41 +03:00
Pavel Kirpichenkov 8c52bb4212 Add frontend checks for missing dependency supertypes
Call checker and declaration checker are used in order to preserve backward compatibility.
Attempt to use classifier usage checker was not good enouth,
since not all errors found with it would actually be reported before.
For example types and constructor calls don't cause supertypes to resolve,
so missing supertypes would not lead to errors in case they are the only use of class name.

Updated tests failing due to missing Java dependencies in superclasses.
2019-11-18 12:06:41 +03:00
Pavel Kirpichenkov 388cd53105 Add filtering during generation of mockJDK JAR
Adjustments for missing superclasses checker.
Some hierarchies in mock JDK are incomplete.
Absence of its .class file causes some tests to fail without an actual error.
To mitigate this problem, top-level classes and interfaces can only inherit from entries that belong to mock JDK.
Absent superclasses are replaced with java.lang.Object.
This only affects runtime jar of mock JDK.
2019-11-18 12:06:41 +03:00
Ilya Chernikov 27ff2d7816 Prohibit using array based on non-reified type parameters as reified type arguments
#KT-31227 fixed
2019-11-18 09:32:52 +01:00
Andrey Uskov 8a1f8714e7 Fix GradleConfiguratorTest
Kotlin gradle plugin was removed from test classpath
2019-11-18 11:26:13 +03:00
Mikhail Zarechenskiy 43d916e92d [NI] Add tests for obsolete issues
#KT-26303 Obsolete
 #KT-32205 Obsolete
2019-11-18 10:25:41 +03:00
victor.petukhov cf161f8234 Rework notForIncompletionCall test 2019-11-17 15:19:28 +03:00
pyos ba93bdb14d JVM_IR: keep the $default suffix for stubs for @JvmName functions
Technically a backwards compatibility problem, as the new backend
*consistently* renamed `f$default` on `f` with `@JvmName("g")` to
`g` instead of `g$default`, so it all worked out. However, this
breaks when encountering libraries compiled with the non-IR backend.
2019-11-15 17:40:52 +01:00
Steven Schäfer 23dfade24f JVM IR: Fix inlining of inline class properties in external modules 2019-11-15 17:30:16 +01:00
Vladimir Dolzhenko fa62d0c325 Don't clear InBlockModifications on CanceledException
#KT-34914 Fixed
2019-11-15 15:48:27 +01:00
Pavel Kirpichenkov 92dae5d8a9 [NI] Split substitution of inferred type parametes into two steps
Substituting inferred type parameters with single substitutor leads
to incorrect behaviour in cases, when class' type parameters are used in constructor.
As a side effect of two-step substitution, intermediate descriptor is created,
which prevents incorrect substitution. To preserve this side effect, single
resulting substitutor was split into two substitutors: one for substituting fresh
variables and another for substituting inferred variables and known parameters.

^KT-32415 Fixed
2019-11-15 16:58:32 +03:00
Pavel Kirpichenkov b6af13f18d [NI] Add missing substitution of known type parameters
Known type parameters appear after inheriting from class with type
parameters. Their substitution matters for inner class constructor,
because without substitution it's parameters will be type checked
against incorrect (original) parameter descriptor with unsubstituted
type parameters.

Skip creation of composite substitutor, if old substitutor is empty.

New substitutors return null in case they don't substitute a type,
but old type substitutors have explicit isEmpty method. Composite
substitutor with empty old substitutor leads to creation
of incorrect descriptor copies.
2019-11-15 16:58:07 +03:00
Pavel Kirpichenkov 3122f2704c [Minor] Refactor resulting descriptor substitution in call transformer 2019-11-15 16:58:07 +03:00
Pavel Kirpichenkov ea66f02035 [Minor] Rename fresh variable substitutor in resolved atom 2019-11-15 16:58:07 +03:00
victor.petukhov 25f3de2085 Use more stable kotlin dependency in tests for enabling inline classes flag 2019-11-15 16:13:44 +03:00
Sergey Bogolepov 4438dd282f [kotlinx-metadata-klib] Bugfixes:
1. Add dependency on `:core:descriptors`
2. Wrap module name with < and >
3. Remove redundant question marks.
4. Fix string table writing.
2019-11-15 19:10:30 +07:00
Sergey Bogolepov 95399b3a41 Introduce kotlinx-metadata-klib.
`kotlinx-metadata-klib` is an extension of `kotlinx-metadata` that can be used to read and write metadata that is stored inside KLIBs.
Note: current version is in its early days and in active development. Almost nothing is stable or properly tested.
2019-11-15 16:38:07 +07:00
Ilya Gorbunov d91453fb7a Do not preprocess apiVersionIsAtLeast calls inlined into kotlin package
If such call were to be inlined into an inline function in kotlin
package, it would be expanded there preventing the further expansion in
client code.
2019-11-15 05:22:24 +03:00
Andrey Uskov 352a10a0ed Do not fail tests on unknown version of gradle Kotlin plugin 2019-11-14 21:13:21 +03:00
Andrey Uskov e963b71921 Tests of import with latest gradle plugin are implemented 2019-11-14 21:13:19 +03:00
Andrey Uskov 51590ef1b7 Migrate import tests to annotation-driven determination of target
kotlin plugin versions
2019-11-14 21:13:16 +03:00
Andrey Uskov d05f893233 Import tests with gradle 5.6.4 were added 2019-11-14 21:13:13 +03:00
Andrey Uskov a51e2ca4d6 Limit initial heap of gradle daemon in import tests 2019-11-14 21:13:11 +03:00
Andrey Uskov 1f2767ae21 Remove gradle testing import from gradle 3.x 2019-11-14 21:13:09 +03:00
Andrey Uskov 48f6207d26 Support annotation-based declaration of target plugin and gradle version
in gradle importing tests
2019-11-14 21:13:07 +03:00
Andrey Uskov 14aa0eae71 Extract kotlin gradle plugin versions to constants in tests 2019-11-14 21:13:05 +03:00
Roman Golyshev 633005fb57 KT-25732 Perform keywords completion earlier to complete them before freeze
- If you complete keywords too late, the completion list may become frozen, and `null` will never make it to the top of it
- Remove `flushToResultSet` between `addReferenceVariantElements` calls because flush already happens inside of them
- ^KT-25732 Fixed
2019-11-14 19:50:38 +03:00
Alexander Udalov 36ca280b86 Fix compilation error in ResolveInlineCalls.kt 2019-11-14 17:19:27 +01:00
Mikhail Glukhikh 635add4823 FIR substitution: generate fake overrides for accessor symbols 2019-11-14 19:10:59 +03:00
Mikhail Glukhikh bd70daa3d1 FIR Java: use definitely not-null types for type parameters
We support & use ConeDefinitelyNotNullType more properly here
2019-11-14 19:10:59 +03:00
Mikhail Glukhikh 63f38bb28a FIR [rendering only]: render fake overrides for properties 2019-11-14 19:10:58 +03:00
Dmitriy Novozhilov 4733c78a6a [FIR] Add toString() to ErrorTypeConstructor and ConeClassifierLookupTag 2019-11-14 18:33:47 +03:00
Dmitriy Novozhilov 944be132de [FIR-TEST] Add test with calling constructor of type with aliased import 2019-11-14 18:33:47 +03:00
Dmitriy Novozhilov d9fe70f97c [FIR] Fix binding overrides with flexible types in arguments 2019-11-14 18:33:47 +03:00
Dmitriy Novozhilov 3a7251a90b [FIR-TEST] Add test with problems in mapping getter name to property name 2019-11-14 18:33:47 +03:00
Dmitriy Novozhilov 6f9e576502 [FIR-TEST] Add test with ambiguity on accidental override property 2019-11-14 18:33:47 +03:00