[IR][tests] Extend test for IR linkage issues related to functions
This commit is contained in:
+5
-3
@@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
fun foo(): String = "FAIL1"
|
fun foo(): String = "FAIL1"
|
||||||
|
fun exp_foo(): String = "FAIL2"
|
||||||
|
|
||||||
fun exp_foo() = "FAIL2"
|
class A {
|
||||||
|
fun foo(): String = "FAIL3"
|
||||||
|
fun exp_foo(): String = "FAIL4"
|
||||||
|
}
|
||||||
|
|||||||
+4
-2
@@ -1,3 +1,5 @@
|
|||||||
|
fun foo(): String = "OK"
|
||||||
|
|
||||||
|
class A {
|
||||||
fun foo(): String = "K"
|
fun foo(): String = "OK"
|
||||||
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,2 +1,2 @@
|
|||||||
|
fun qux(exp: Boolean): String = if (exp) exp_foo() else foo()
|
||||||
fun qux(exp: Boolean): String = if (exp) exp_foo() else foo()
|
fun qux2(exp: Boolean): String = if (exp) A().exp_foo() else A().foo()
|
||||||
|
|||||||
+16
-3
@@ -2,16 +2,29 @@ fun test1(): String {
|
|||||||
try {
|
try {
|
||||||
return qux(true)
|
return qux(true)
|
||||||
} catch(e: Throwable) {
|
} catch(e: Throwable) {
|
||||||
if (e.isLinkageError("/exp_foo")) return "O"
|
if (e.isLinkageError("/exp_foo")) return "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL2"
|
return "FAIL5"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test2(): String = qux(false)
|
fun test2(): String = qux(false)
|
||||||
|
|
||||||
|
fun test3(): String {
|
||||||
|
try {
|
||||||
|
return qux2(true)
|
||||||
|
} catch(e: Throwable) {
|
||||||
|
if (e.isLinkageError("/A.exp_foo")) return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
return "FAIL6"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test4(): String = qux2(false)
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return test1() + test2()
|
val result = test1() + test2() + test3() + test4()
|
||||||
|
return if (result == "OKOKOKOK") "OK" else result
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
||||||
|
|||||||
Reference in New Issue
Block a user