[IR][tests] Add tests for IR linkage issues related to properties
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
val foo: String get() = "FAIL1"
|
||||
val exp_foo: String get() = "FAIL2"
|
||||
|
||||
class A {
|
||||
val foo: String get() = "FAIL3"
|
||||
val exp_foo: String get() = "FAIL4"
|
||||
}
|
||||
|
||||
class B {
|
||||
val foo: String = "FAIL5"
|
||||
val exp_foo: String = "FAIL6"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
val foo: String get() = "OK"
|
||||
|
||||
class A {
|
||||
val foo: String get() = "OK"
|
||||
}
|
||||
|
||||
class B {
|
||||
val foo: String = "OK"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
STEP 0:
|
||||
dependencies: stdlib
|
||||
STEP 1:
|
||||
dependencies: stdlib
|
||||
modifications:
|
||||
U : l1.kt.1 -> l1.kt
|
||||
@@ -0,0 +1,3 @@
|
||||
fun qux(exp: Boolean): String = if (exp) exp_foo else foo
|
||||
fun qux2(exp: Boolean): String = if (exp) A().exp_foo else A().foo
|
||||
fun qux3(exp: Boolean): String = if (exp) B().exp_foo else B().foo
|
||||
@@ -0,0 +1,2 @@
|
||||
STEP 0:
|
||||
dependencies: stdlib, lib1
|
||||
@@ -0,0 +1,43 @@
|
||||
fun test1(): String {
|
||||
try {
|
||||
return qux(true)
|
||||
} catch(e: Throwable) {
|
||||
if (e.isLinkageError("/exp_foo.<get-exp_foo>")) return "OK"
|
||||
}
|
||||
|
||||
return "FAIL7"
|
||||
}
|
||||
|
||||
fun test2(): String = qux(false)
|
||||
|
||||
fun test3(): String {
|
||||
try {
|
||||
return qux2(true)
|
||||
} catch(e: Throwable) {
|
||||
if (e.isLinkageError("/A.exp_foo.<get-exp_foo>")) return "OK"
|
||||
}
|
||||
|
||||
return "FAIL8"
|
||||
}
|
||||
|
||||
fun test4(): String = qux2(false)
|
||||
|
||||
fun test5(): String {
|
||||
try {
|
||||
return qux3(true)
|
||||
} catch(e: Throwable) {
|
||||
if (e.isLinkageError("/B.exp_foo.<get-exp_foo>")) return "OK"
|
||||
}
|
||||
|
||||
return "FAIL9"
|
||||
}
|
||||
|
||||
fun test6(): String = qux3(false)
|
||||
|
||||
fun box(): String {
|
||||
val result = test1() + test2() + test3() + test4() + test5() + test6()
|
||||
return if (result == "OKOKOKOKOKOK") "OK" else result
|
||||
}
|
||||
|
||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
||||
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked IR symbol $symbolName|") == true
|
||||
@@ -0,0 +1,2 @@
|
||||
STEP 0:
|
||||
dependencies: stdlib, lib1, lib2
|
||||
@@ -0,0 +1,7 @@
|
||||
MODULES: lib1, lib2, main
|
||||
|
||||
STEP 0:
|
||||
libs: lib1, lib2, main
|
||||
|
||||
STEP 1:
|
||||
libs: lib1
|
||||
Reference in New Issue
Block a user