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.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// !LANGUAGE: +InlineClasses -MangleClassMembersReturningInlineClasses
|
||||
// WITH_RUNTIME
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
inline class S(val x: String)
|
||||
|
||||
class Test {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@JvmName("getO")
|
||||
fun getOK() = S("OK")
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val t = Test()
|
||||
return t.getOK().x
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !LANGUAGE: +InlineClasses -MangleClassMembersReturningInlineClasses
|
||||
// WITH_RUNTIME
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
inline class S(val string: String)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@JvmName("foo")
|
||||
inline fun foo() = S("OK")
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box() : String =
|
||||
foo().string
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !LANGUAGE: +InlineClasses +MangleClassMembersReturningInlineClasses
|
||||
// WITH_RUNTIME
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
inline class S(val string: String)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@JvmName("foo")
|
||||
inline fun foo() = S("OK")
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box() : String =
|
||||
foo().string
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// WITH_RUNTIME
|
||||
inline class IC(val x: Int)
|
||||
|
||||
class C {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@JvmName("test")
|
||||
fun test() = IC(42)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@JvmName("differentName")
|
||||
fun test2() = IC(42)
|
||||
}
|
||||
|
||||
fun call1() = C().test()
|
||||
|
||||
fun call2() = C().test2()
|
||||
|
||||
// 1 public final test\(\)I
|
||||
// 1 INVOKEVIRTUAL C.test \(\)I
|
||||
// 1 public final differentName\(\)I
|
||||
// 1 INVOKEVIRTUAL C.differentName \(\)I
|
||||
Reference in New Issue
Block a user