Add ClassDescriptor.getInlineClassRepresentation

This will be used at least in the JVM backend instead of the current
approach where we're loading the primary constructor's first parameter,
which isn't good enough since primary constructor can be private, and
we can't rely on private declarations in case they're declared in
another module.
This commit is contained in:
Alexander Udalov
2021-03-23 12:58:53 +01:00
parent 6aaff9dfb7
commit 7fb3f48c67
22 changed files with 214 additions and 11 deletions
@@ -0,0 +1,14 @@
// WITH_RUNTIME
// MODULE: lib
// FILE: A.kt
inline class A(val value: String) {
val Char.value: String get() = this + nonExtensionValue()
fun nonExtensionValue(): String = value
}
// MODULE: main(lib)
// FILE: B.kt
fun box(): String = with(A("K")) { 'O'.value }
@@ -0,0 +1,16 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// MODULE: lib
// USE_OLD_INLINE_CLASSES_MANGLING_SCHEME
// FILE: A.kt
inline class A(val value: String) {
val Char.value: String get() = this + nonExtensionValue()
fun nonExtensionValue(): String = value
}
// MODULE: main(lib)
// FILE: B.kt
fun box(): String = with(A("K")) { 'O'.value }