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:
Dmitry Petrov
2020-06-03 15:55:40 +03:00
parent 8a4521864e
commit 202bbdf8dd
23 changed files with 184 additions and 11 deletions
@@ -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
@@ -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