Commit Graph

12 Commits

Author SHA1 Message Date
Alexander Udalov b417786fd4 JVM IR: do not hide constructor with inline class in anonymous object
#KT-45131 Fixed
2021-02-25 14:44:16 +01:00
Dmitriy Novozhilov 64a300bfcd [TD] Update testdata according to previous commit 2021-02-02 17:53:52 +03:00
Alexander Udalov ad5b6da273 JVM IR: substitute generic type for inline class replacement function calls
The main change here is in `JvmInlineClassLowering.visitFunctionAccess`,
where we now store the substituted return type of the function as the
type of the call expression. Without it, the call could have a
meaningless type, e.g. some `T` which is inaccessible at that place, and
that could backfire in subsequent lowerings in codegen. For example, in
the `stringPlus.kt` test, it would prevent the code in
`FlattenStringConcatenationLowering.isStringPlusCall` from recognizing
and replacing the `String.plus` call, leading to a codegen exception.

Other changes are mostly cosmetics to make the code similar to
`visitFunctionReference`, and preventive optimizations for the case when
the substitution map is empty.
2020-10-28 16:46:28 +01:00
Ilmir Usmanov a775fa195b Unbox inline class parameter of lambda if underlying type is Any or Any?
The inline class is boxed when we pass it as lambda argument, now we
unbox it. If the underlying type is not Any or Any?, bridge method does
the unboxing.

 #KT-32450 Fixed
 #KT-39923 Fixed
 #KT-32228 Fixed
 #KT-40282 Fixed
2020-10-26 17:34:37 +01:00
Dmitry Petrov a2dabe11c5 JVM KT-41150: Fix backward compatibility for inline vals in inline class
In 1.3.x, for inline class member inline vals 'getFoo-impl' method was
generated in corresponding inline class.
Since 1.4.0, getters for properties returning inline class values are
mangled (so corresponding getters are named 'getFoo-<mangling_hash>'.
However, to maintain backward compatibility with libraries compiled with
1.3.x, inliner should be able to find 'getFoo-impl' method in the
bytecode.
2020-08-24 16:17:12 +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
Steven Schäfer e4609a9968 JVM IR: Cache inline class replacements at the module level 2019-09-20 23:41:39 +02:00
Dmitry Petrov 3080b65f7d Inline (wrapper) class IC extends erased inline class IC$Erased 2018-09-05 12:20:57 +03:00
Mikhail Zarechenskiy 1497c19dc9 Do not generate useless methods inside wrapper for inline class
Fix for test data (inlineFunctionInsideInlineClassesBox.kt) is needed
 to avoid check about "no inline functions".

 This check has two steps: first, names of inline functions from
 the metadata are loaded, then these names are checked that they are
 presented for physical methods in the classfile.

 Because now there are no physical methods in the classfile, we can't pass
 the second check, therefore this fix is needed.

 #KT-24872 Fixed
2018-08-07 12:15:46 +03:00
Mikhael Bogdanov e149cbe852 Mute failed jvm ir tests 2018-06-28 12:26:41 +02:00
Mikhail Zarechenskiy b25a1d9522 Support inline functions inside inline classes 2018-05-07 15:25:46 +03:00