[IR][tests] Extend test for IR linkage issues related to functions

This commit is contained in:
Dmitriy Dolovov
2022-05-23 16:10:26 +03:00
committed by Space
parent f22eed6dd8
commit 2476d1bbb6
4 changed files with 27 additions and 10 deletions
+5 -3
View File
@@ -1,5 +1,7 @@
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
View File
@@ -1,3 +1,5 @@
fun foo(): String = "OK"
fun foo(): String = "K"
class A {
fun foo(): String = "OK"
}
+2 -2
View File
@@ -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
View File
@@ -2,16 +2,29 @@ fun test1(): String {
try {
return qux(true)
} 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 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 {
return test1() + test2()
val result = test1() + test2() + test3() + test4()
return if (result == "OKOKOKOK") "OK" else result
}
private fun Throwable.isLinkageError(symbolName: String): Boolean =