Commit Graph

2891 Commits

Author SHA1 Message Date
Pavel Punegov a04aeeb4e1 Ignore broken test in Native 2020-05-25 20:58:43 +03:00
Mikhail Zarechenskiy 2cee82a348 [NI] Resolve receiver of provideDelegate independently
#KT-38259 Fixed
2020-05-25 16:06:55 +03:00
Jinseong Jeon 0d3301b695 FIR: resolve local class in anonymous initializer. 2020-05-21 08:36:49 +03:00
Mikhail Zarechenskiy 8bdc4d34f7 [NI] Commonize type-conversions (SAM/Suspend)
- Allow participating subtypes of functional types in conversions
 - Fix several subtle inconsistencies
 - Place logic about conversions at one place

 Now conversions operations have two stages: before usual subtyping
 check and after one. This is needed to support conversions of
 subtypes (of functional types, for example). First, the compiler
 checks if it possible to resolve an argument without conversion and
 only then it tries to perform conversion.
 Note that it'd be incorrect to perform conversion eagerly as it can
 change resolve (Runnable & () -> Unit <: KRunnable), plus we can't
 guess whether conversion is needed at all as it's important not to
 look into supertypes if resolution doesn't actually needed it

 #KT-36448 Fixed
 #KT-37574 Fixed
 #KT-38604 Fixed
2020-05-20 15:30:14 +03:00
Dmitry Petrov 16e7a42aea JVM: Fix line numbers in test 2020-05-20 07:19:30 +03:00
Dmitry Petrov e625bb375f Temporarily mute unsigned tests in JVM_IR and FIR 2020-05-20 07:19:30 +03:00
Dmitry Petrov cf70c83ab7 JVM: Update tests 2020-05-20 07:19:29 +03:00
Dmitry Petrov 2f82c5b6af JVM: Fix default parameter values handling
When we generate call for 'foo', we make decision about invoking
a 'foo$default' too late, after the call arguments are generated.
If 'foo' was an override, and base class (interface) was generic,
'foo' in base class could have a different Kotlin and JVM
signature, so the arguments we generated could be generated wrong
(primitive or inline class values instead of boxes, see KT-38680).
Also, we always selected first base class in supertypes list,
which caused KT-15971.

Look into resolved call and see if we should actually call
'foo$default' instead of 'foo' when determining actual callable.

Overrides can't introduce default parameter values, and
override-equivalent inherited methods with default parameters
is an error in a child class. Thus, if we are calling a class
member function with a default parameters, there should be one
and only one overridden function that has default parameter values
and overrides nothing.
2020-05-20 07:19:29 +03:00
Dmitry Petrov dc9f64fc9d JVM: Fix reflection tests for new IC ABI 2020-05-20 07:19:28 +03:00
Dmitry Petrov b5bd3604b1 JVM: Mangle functions returning inline class values
Mangling suffix is base64-encoded MD5 of ":<returnTypeFQN>"
2020-05-20 07:19:28 +03:00
Mark Punzalan 425ce8c3ab [FIR] Use flexible type lower bound when approximating type for
IntegerLiteral.
2020-05-19 15:42:49 +03:00
Mark Punzalan 89d706972c [FIR] Use vararg element type when generating argument mapping. 2020-05-19 15:41:29 +03:00
Mark Punzalan 371c4561a0 [IR/FIR] Use isExpect from IR element instead of descriptor in
ExpectDeclarationRemover.
2020-05-18 17:20:43 +02:00
Denis Zharkov e1e149a062 FIR: Support coercion-to-unit semantics for callable references 2020-05-18 11:17:45 +03:00
Jinseong Jeon 61def4cdc5 FIR: set function factory (before it's used in SAM lowering). 2020-05-18 09:36:22 +03:00
Denis Zharkov b691b13d8e FIR: Add separate local scopes for blocks 2020-05-15 16:04:44 +03:00
Denis Zharkov 687a58843f FIR: Rewrite visibility checking
Unbound it from implicit receiver stack as it only needs scope structure/declaration nestedness
Semantics for protected has been changed in a way it works in old FE

NB: We should report additional diagnostic in case of CallCompanionProtectedNonStatic.fir.kt
(see KT-38814)
2020-05-15 16:04:44 +03:00
Jinseong Jeon 615636ed55 FIR2IR: apply SAM conversion to arguments of functional type. 2020-05-15 15:08:43 +03:00
Alexander Udalov 82551e91a4 Add KClass.isFun modifier to reflection
#KT-38881 Fixed
2020-05-14 14:05:51 +02:00
Anton Bannykh 86b5c63891 JS IR: fix origin for callable references with bound reciever
In case of IrFunctionReference with type SuspendFunction (no K!) there
was a misalignment between the base class (Any) and the
origin (LAMBDA..). As a result the SuspendFunctionLowering was
getting confused and produced hanging code.
2020-05-14 14:33:12 +03:00
Anton Bannykh bdca4b45bd JS: inliner supports extra argument caused by suspend conversions 2020-05-14 14:33:12 +03:00
Mikhail Glukhikh cdac6157a9 [FIR2IR] Force loading Java SAM from external classes 2020-05-14 14:07:40 +03:00
Juan Chen 858731cac8 [FIR] add support for varargs in delegated constructor calls
Also add support for spread operators as named arguments.
2020-05-14 13:42:07 +03:00
Mikhail Glukhikh 3652ac9354 [FIR2IR] Mute 2 failing BB tests
Looks like both tests are failing because now only classes from
'kotlin.*' are considered "external" and generated with declarations.
2020-05-14 13:40:37 +03:00
Mikhail Glukhikh e7e80be34a [FIR2IR] Populate overridden symbols even for !isOverride
Before this commit we considered !isOverride as a sign that
function / field / accessor has no overridden symbols.
However, it's false for deserialized, because isOverride
is always false there.

This commit fixes 68 BB tests but breaks 25 BB tests (not yet muted)
2020-05-14 13:40:36 +03:00
Jinseong Jeon 931ba4892a FIR2IR: split property annotations according to use-site targets. 2020-05-14 09:41:11 +03:00
Steven Schäfer 497df0922a JVM IR: Fix corresponding properties in inline classes 2020-05-13 20:57:52 +02:00
pyos 8809abdbac JVM_IR: do not handle Nothing in suspend tail call bridges
Else they wouldn't be tail call, would they?
2020-05-13 05:54:37 -07:00
Ilmir Usmanov 0acaedef92 Fix attribute clash between STATIC_INLINE_CLASS_REPLACEMENT and original
Attributes are used to name continuation classes and are generated
before inline classes processing. During the processing, for override
functions in inlined classes, the compiler generates
STATIC_INLINE_CLASS_REPLACEMENT function with body of the override.
The override's body is replaced with delegating call to
STATIC_INLINE_CLASS_REPLACEMENT. However, since we need to keep the name
of the continuation class, we copy attributes from the override to
STATIC_INLINE_CLASS_REPLACEMENT. This leads to attribute clash during
AddContinuationLowering.
So, to fix the issue, do not use the attribute of
STATIC_INLINE_CLASS_REPLACEMENT in original->suspend map.
As an optimization, do not generate continuation for the override
function.
2020-05-13 14:53:37 +02:00
Alexander Udalov d2a691d157 Minor, ignore failing box tests for light analysis 2020-05-13 13:54:51 +02:00
Mark Punzalan b5b361bb09 Add tests for nullable loop variable in for-loop over unsigned progression. 2020-05-13 13:54:35 +02:00
Mark Punzalan eaddd02e9b Mute/unmute failing/passing unsigned progression tests for FIR. 2020-05-13 13:54:35 +02:00
Mark Punzalan 0e6af517d7 Generate tests for unsigned progressions using
GenerateSteppedRangesCodegenTestData.
2020-05-13 13:54:35 +02:00
Jinseong Jeon 6034fcdc46 FIR2IR: apply SAM conversion to arguments if needed 2020-05-13 11:28:48 +03:00
Alexander Udalov 0ce16b9d8c Support non-reified type parameters in typeOf in JVM and JVM_IR
#KT-30279 Fixed
2020-05-13 10:04:28 +02:00
Mikhael Bogdanov 5ef37148ea Add flag for proper array convention with default args calls 2020-05-13 08:51:57 +02:00
Mikhail Bogdanov adc770b604 Process default arguments in array convention calls
#KT-16520 Fixed
2020-05-13 08:51:57 +02:00
Jinseong Jeon 30e5748fec FIR: set proper visibility of property accessors. 2020-05-12 19:47:37 +03:00
Mikhail Glukhikh 28c0dac36f [FIR] Set FirJavaClass.isInner properly 2020-05-12 16:57:07 +03:00
Mikhail Glukhikh 457fb09e3a [FIR] Use tower to resolve delegated constructors, set dispatch receiver 2020-05-12 16:57:07 +03:00
Jinseong Jeon fd584e6f13 FIR2IR: fix offsets for calls. 2020-05-09 21:11:40 +03:00
Jinseong Jeon eac9af521e [FIR2IR] differentiate external Java stub origin from external stub 2020-05-08 17:45:39 +03:00
Mikhail Glukhikh b271b6d7a8 [FIR2IR] Add conversion of value parameter annotations 2020-05-08 17:30:28 +03:00
Mikhail Glukhikh 76f6e27e37 [FIR2IR] Add initial support of collection literals 2020-05-08 17:30:24 +03:00
Mikhail Glukhikh f3e2dbf360 [FIR2IR] Add conversion of function annotations 2020-05-08 17:30:19 +03:00
Alexander Udalov 91ef053fbc IR: keep local scope with counter maps across LDL invocations
Since LocalDeclarationsLowering is a BodyLoweringPass, local
functions inside one declaration are handled independently of local
functions in the other declaration. This can lead to name clashes, in
case a local function with the same name and signature is declared in
overloads in the same container, which results in a signature clash
error in JVM IR.

The issue became more common with the introduction of adapted function
references, where psi2ir generates a local adapter-function with a
predefined name, which can easily clash with another reference to the
same target in an overload. This led to a compilation error when
bootstrapping Kotlin with JVM IR, for example in GradleIRBuilder.kt
where there are a lot of references to the same function.
2020-05-08 14:33:34 +02:00
Mikhail Glukhikh d8f9643650 [FIR2IR] Use intersection type approximation for receivers 2020-05-07 15:27:17 +03:00
Steven Schäfer 821aca984b JVM IR: Take superQualifierSymbols into account when lowering inline classes 2020-05-07 11:44:09 +02:00
Mikhail Glukhikh 38fc4d0f1f FIR: set & use dispatch receiver for q. access with super reference 2020-05-07 12:02:57 +03:00
Jinseong Jeon 7b01cf7b04 FIR: handle labeled super reference properly 2020-05-07 12:02:56 +03:00