feb968e66d
Local declarations obtain names prefixed with outer function's name. Only simple name (i.e. without mangling) of outer function used in this case. This raises a problem in case of inline functions with object literals. Currently, they are not copied, but exported from module. Consider two inline functions foo with different signatures, both declare object literals. In this case both literals are exported as foo$f, so only one will be accessible from outside.
25 lines
459 B
Kotlin
Vendored
25 lines
459 B
Kotlin
Vendored
// FILE: a.kt
|
|
|
|
inline fun foo(x: String): I = object : I {
|
|
override fun get(): String = "foo_String($x)"
|
|
}
|
|
|
|
// FILE: b.kt
|
|
inline fun foo(x: Int): I = object : I {
|
|
override fun get(): String = "foo_Int($x)"
|
|
}
|
|
|
|
// FILE: main.kt
|
|
interface I {
|
|
fun get(): String
|
|
}
|
|
|
|
fun box(): String {
|
|
val a = foo("1").get()
|
|
if (a != "foo_String(1)") return "fail1: $a"
|
|
|
|
val b = foo(2).get()
|
|
if (b != "foo_Int(2)") return "fail2: $b"
|
|
|
|
return "OK"
|
|
} |