Commit Graph

26639 Commits

Author SHA1 Message Date
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
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 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
Mikhail Zarechenskiy 43d916e92d [NI] Add tests for obsolete issues
#KT-26303 Obsolete
 #KT-32205 Obsolete
2019-11-18 10:25:41 +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
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
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
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
Dmitriy Novozhilov f43d77d422 [FIR-TEST] Move nestedClassConstructor test to problems test suite 2019-11-14 18:33:47 +03:00
Dmitriy Novozhilov 2409a74fb5 [FIR-TEST] Add test for problem with += and java synthetic property 2019-11-14 18:33:46 +03:00
Dmitriy Novozhilov 11063a25a8 [FIR] Replace FirEmptyDiagnostic with FirStubDiagnostic
FirStubDiagnostic hold reason from original diagnostic
It's useful in HTML fir dump
2019-11-14 18:33:46 +03:00
Dmitriy Novozhilov ee20f88837 [FIR] Propagate smartcasts in safe calls chain 2019-11-14 18:33:46 +03:00
Dmitriy Novozhilov 833648d8e0 [FIR] Fix smartcasts on receivers of implict invoke call 2019-11-14 18:33:46 +03:00
Dmitriy Novozhilov 660bcce90a [FIR] Add smartcasts for reassigned vars 2019-11-14 18:33:46 +03:00
Dmitriy Novozhilov 2a74e37e28 [FIR] Ignore expected type for resolve constant expressions 2019-11-14 18:33:46 +03:00
Dmitriy Novozhilov 6a3c07688f Add print of detailed stack trace to NonFir modularized test 2019-11-14 18:33:46 +03:00
pyos a235dd2891 IR: move defaultParameterDeclarationsCache access up one level
to avoid recomputing overriddenSymbols for fake overrides of default
stubs on repeated calls to generateDefaultsFunction.
2019-11-14 17:41:47 +03:00
pyos 70f09a7531 IR: make DefaultArgumentStubGenerator a few lines shorter 2019-11-14 17:41:47 +03:00
pyos 2b2dd097a3 IR: refactor DefaultParameterInjector 2019-11-14 17:41:47 +03:00
pyos 7a2715da44 IR: refactor generateDefaultsFunction
The check for whether a function needs a default stub should run fewer
times now, and in particular is no longer quadratic. Also, this fixes
a weirdness in that certain inheritance hierarchies would produce
a default stub that points to a non-stub through its overriddenSymbols
field.
2019-11-14 17:41:47 +03:00
pyos 29a14e2330 JVM_IR: resolve inline fake overrides before codegen
See KT-33054 and KT-29242.
2019-11-14 15:29:24 +01:00
Denis Zharkov b0327964b7 Fix compilation on 183 and as34 2019-11-14 11:26:11 +03:00
Mikhael Bogdanov 744dfc6bf9 Minor. Pass proper timeout to logger 2019-11-14 08:32:36 +01:00
Mikhael Bogdanov 4281fd6bd5 Don't write nop for extension lambda during inline 2019-11-14 08:17:33 +01:00
Alexander Udalov fb9fb2e048 JVM IR: minor, remove obsolete code 2019-11-13 19:30:26 +01:00
Alexander Udalov 180e718752 JVM IR: minor, repurpose JvmBackendContext.getLocalClassInfo to store Type 2019-11-13 19:26:40 +01:00
Alexander Udalov 6be9101675 JVM IR: add jvmLocalClassExtractionPhase to lift out local classes from initializers
Otherwise a local class in a field initializer or anonymous init block
is copied into each constructor of the containing class (because
InitializersLowering calls deepCopy).

Since the code structure no longer resembles the original source code
here, record a custom EnclosingMethod mapping before moving such
classes, and use it in codegen.
2019-11-13 19:26:39 +01:00
Georgy Bronnikov c5159d9cbe IR: Add UniqId to IrSymbol 2019-11-13 20:07:57 +03:00
Georgy Bronnikov 1647279a8c IR: move UniqId to ir.tree module 2019-11-13 20:07:57 +03:00
Georgy Bronnikov 76016b1a3c IR: move KotlnMangler to ir.tree module 2019-11-13 20:07:57 +03:00
Georgy Bronnikov 92ebb092a2 JvmMangler 2019-11-13 20:07:57 +03:00