Commit Graph

267 Commits

Author SHA1 Message Date
Dmitry Petrov
b00ce872ea JVM: record JVM signature for equals/hashCode/toString in inline classes 2020-09-07 12:25:50 +03:00
Mikhail Glukhikh
02b6f34067 [FIR2IR] Add extension receiver parameter to delegated members 2020-08-31 14:31:57 +03:00
Mikhail Glukhikh
3f5beb77e8 [FIR2IR] Cache delegatable members properly 2020-08-31 14:31:55 +03:00
Georgy Bronnikov
ea57b4cccb IR: add and unmute tests 2020-08-10 10:16:24 +03:00
Jinseong Jeon
bff36e0199 FIR2IR: convert annotations on FirTypeRef 2020-07-30 11:25:36 +03:00
Jinseong Jeon
13ef97e51e FIR2IR: set proper visibility of backing fields with @JvmField 2020-07-17 12:42:11 +03:00
Mikhail Glukhikh
1bbed6c4ed [FIR2IR] Use FIR-specific methods to search for overridden functions 2020-07-15 13:36:28 +03:00
Jinseong Jeon
3afc37438e FIR: handle getClassCall with integer literals 2020-07-08 18:23:27 +03:00
Juan Chen
d163853c97 [FIR] add support for implementation by delgation
This commit handles "subclass: super-interface by delegate-expression".

During Psi2Fir, for each delegate, we add to the subclass a synthetic
field (which has type super-interface), and an assignment of the
delegate-expression to the synthetic field in the primary constructor,
so that the delegate-expression can be resolved and transformed along
the way.

During Fir2Ir, we look up delegatable members from the super-interface
and generate corresponding functions/properties for the subclass.

TODO: support for generic delegatable members and generic
super-interface.
2020-07-08 09:42:24 +03:00
Dmitriy Novozhilov
8311c1f0e2 [FIR] Fix projection of Comparable supertype for ILT
#KT-39048 Fixed
2020-07-03 17:09:28 +03:00
Jinseong Jeon
ab2a2b3a87 FIR2IR: eager conversion of annotations in Library class and members 2020-06-11 10:57:51 +03:00
Mark Punzalan
802beb49a6 Use TypeSubstitutor to get the substituted underlying type for inline
classes, instead of MemberScope.

The primary motivation was to fix issues around type-mapping for inline
classes in FIR, which uses wrapped descriptors that have empty
MemberScopes.
2020-06-04 17:03:55 +03:00
Dmitry Petrov
202bbdf8dd Forward compatibility hacks for Result.{success, failure}
Don't mangled functions annotated with @JvmName.
Annotate 'Result.success' and 'Result.failure' with @JvmName and
@Suppress("INAPPLICABLE_JVM_NAME").
NB this would require bootstrap.
2020-06-04 12:16:27 +03:00
Dmitry Petrov
a270ee094c Language feature for new inline class mangling rules (since 1.4) 2020-05-29 00:53:01 +03:00
Mikhail Glukhikh
19f1a3de1a [FIR2IR] Populate overridden symbols also with public symbol inheritors 2020-05-28 22:19:21 +03:00
Mikhail Glukhikh
85760770a8 [FIR2IR] Initialize built-in symbols at start of conversion 2020-05-28 22:18:20 +03:00
Mikhail Glukhikh
cd24745f1f [FIR2IR] Add primitive signature composer & use it for external classes 2020-05-28 22:18:13 +03:00
Steven Schäfer
dc0ef996b7 JVM IR: Implement the new inline class ABI 2020-05-28 18:00:35 +03:00
Vitaly
fe047f9b47 [JS BE] mutes tests for JS_IR_ES6, which muted for JS_IR 2020-05-27 00:32:56 +03:00
Dmitry Petrov
2f79b4c412 Add test for KT-34902 2020-05-26 11:59:05 +03:00
Dmitry Petrov
e625bb375f Temporarily mute unsigned tests in JVM_IR and FIR 2020-05-20 07:19:30 +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
b5bd3604b1 JVM: Mangle functions returning inline class values
Mangling suffix is base64-encoded MD5 of ":<returnTypeFQN>"
2020-05-20 07:19:28 +03:00
Steven Schäfer
497df0922a JVM IR: Fix corresponding properties in inline classes 2020-05-13 20:57:52 +02:00
Mikhail Glukhikh
f3e2dbf360 [FIR2IR] Add conversion of function annotations 2020-05-08 17:30:19 +03:00
Steven Schäfer
821aca984b JVM IR: Take superQualifierSymbols into account when lowering inline classes 2020-05-07 11:44:09 +02:00
Jinseong Jeon
9a561f4a7c FIR2IR: generate synthetic members for inline class 2020-04-30 13:09:53 +03:00
Mikhail Glukhikh
f98c73cb30 [FIR] Support FirMetadataSource.File in FIR2IR & serializer (KT-38156) 2020-04-28 07:35:04 +03:00
Jinseong Jeon
ef09850df8 FIR2IR: set superQualifierSymbol for super call 2020-04-27 11:50:26 +03:00
Jinseong Jeon
57fe01c375 FIR2IR: populate overriddenSymbols for overriding functions
#KT-38416 Fixed
2020-04-27 11:50:24 +03:00
Dmitry Petrov
318d4d17ba KT-38337 Fix inline class value coercion in delegated members 2020-04-21 13:21:58 +03:00
Mikhail Glukhikh
96d8b0bea3 FIR: make KFunctionX derived from KFunction 2020-04-20 17:05:37 +03:00
Jinseong Jeon
c26adf53dd FIR: resolve suspend lambda properly 2020-04-20 17:05:30 +03:00
Dmitriy Novozhilov
7f02d57d88 [FIR] Correctly detect super type in delegated constructor call 2020-04-17 12:37:29 +03:00
Dmitry Petrov
e2ee3d1d18 Unmute passing tests 2020-04-16 09:07:35 +03:00
Steven Schäfer
74791495d7 JVM IR: Box inline classes in covariant overrides (KT-30419) 2020-04-16 09:07:35 +03:00
Mikhail Glukhikh
e1c78b31a6 [FIR2IR] Convert explicit receiver in advance 2020-04-10 14:49:27 +03:00
Mikhail Glukhikh
5c758af0a6 [FIR] Use ScopeSession from resolve transformer in FIR2IR 2020-04-09 15:22:55 +03:00
Dmitry Petrov
ddf7f53118 Add more tests on inline class boxing in covariant overrides 2020-04-08 19:56:26 +03:00
Dmitry Petrov
9615b20e5d Box inline class return value in lambdas (including suspend lambdas) 2020-04-08 19:56:26 +03:00
Dmitriy Novozhilov
8a2b39d647 [FIR] Add checking receivers of callable references 2020-04-08 10:38:45 +03:00
Dmitry Petrov
d5ace43614 KT-37986 Force boxing of inline class returned from function reference
KT-37998 Provide KotlinType for safe call
2020-04-04 01:32:45 +03:00
Dmitry Petrov
a422a12407 Minor: update testData
In BridgeTest::testFakeOverrideMisleadingImplementation,
order of generated bridges has changed slightly
(but the overall set of generated bridges remains the same).
2020-04-03 18:31:39 +03:00
Mikhail Glukhikh
f374c36cd2 [FIR2IR] Generate property extension receiver references properly 2020-04-03 13:31:15 +03:00
Mikhail Glukhikh
f3f7bf70f6 [FIR] Set delegate field receiver properly 2020-04-03 13:29:55 +03:00
Jinseong Jeon
3e6b38a921 [FIR] Fix type reference for 1st arg of GetClassCall 2020-04-02 12:42:50 +03:00
Mikhail Glukhikh
ffc22f4190 [FIR] Unmute two passing black box tests 2020-04-02 10:28:07 +03:00
Dmitry Petrov
24b8495e00 KT-30419 Box inline classes in return types of covariant overrides
Use boxed version of an inline class in return type position for
covariant and generic-specialized overrides.

Also fixes KT-35234 and KT-31585.
2020-04-01 22:59:14 +03:00
Jinseong Jeon
078cf02c8a FIR: Provide dispatch receiver for 'field' according to property type 2020-03-30 16:57:53 +03:00
Mikhail Glukhikh
810b607a65 [FIR2IR] Provide receivers also for property callable references 2020-03-30 16:23:10 +03:00