mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 08:31:26 +00:00
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.
10 lines
164 B
Kotlin
Vendored
10 lines
164 B
Kotlin
Vendored
// !LANGUAGE: +InlineClasses
|
|
|
|
fun <T> foo(a: IC): T = a.value as T
|
|
|
|
inline class IC(val value: String)
|
|
|
|
fun box(): String {
|
|
return foo<String>(IC("O")) + "K"
|
|
}
|