[IR][tests] Update tests to reflect changes in partial linkage error messages
This commit is contained in:
+14
-7
@@ -4,16 +4,23 @@ import lib2.B
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a: A = B()
|
val a: A = B()
|
||||||
|
|
||||||
try {
|
return try {
|
||||||
val answer: Int = a.foo() // <-- should throw linkage error here
|
val answer: Int = a.foo() // <-- should throw linkage error here
|
||||||
println(answer)
|
println(answer)
|
||||||
|
"FAIL"
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
if (e.isLinkageError("lib2.B.foo")) return "OK"
|
e.checkLinkageError("foo", "B")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
private fun Throwable.checkLinkageError(symbolName: String, className: String): String {
|
||||||
this::class.simpleName == "IrLinkageError"
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
&& message == "Abstract function $symbolName is not implemented in non-abstract class ${symbolName.substringBeforeLast(".")}"
|
|
||||||
|
val expectedMessage = "Abstract function $symbolName is not implemented in non-abstract class $className"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (expectedMessage == actualMessage)
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessage, ACTUAL: $actualMessage"
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,16 +4,23 @@ import lib2.B
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a: A = B()
|
val a: A = B()
|
||||||
|
|
||||||
try {
|
return try {
|
||||||
val answer: Int = a.foo() // <-- should throw linkage error here
|
val answer: Int = a.foo() // <-- should throw linkage error here
|
||||||
println(answer)
|
println(answer)
|
||||||
|
"FAIL"
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
if (e.isLinkageError("lib2.B.foo")) return "OK"
|
e.checkLinkageError("foo", "B")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
private fun Throwable.checkLinkageError(symbolName: String, className: String): String {
|
||||||
this::class.simpleName == "IrLinkageError"
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
&& message == "Abstract function $symbolName is not implemented in non-abstract class ${symbolName.substringBeforeLast(".")}"
|
|
||||||
|
val expectedMessage = "Abstract function $symbolName is not implemented in non-abstract class $className"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (expectedMessage == actualMessage)
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessage, ACTUAL: $actualMessage"
|
||||||
|
}
|
||||||
|
|||||||
+14
-7
@@ -4,16 +4,23 @@ import lib2.B
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a: A = B()
|
val a: A = B()
|
||||||
|
|
||||||
try {
|
return try {
|
||||||
val answer: Int = a.foo // <-- should throw linkage error here
|
val answer: Int = a.foo // <-- should throw linkage error here
|
||||||
println(answer)
|
println(answer)
|
||||||
|
"FAIL"
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
if (e.isLinkageError("lib2.B.<get-foo>")) return "OK"
|
e.checkLinkageError("foo.<get-foo>", "B")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
private fun Throwable.checkLinkageError(symbolName: String, className: String): String {
|
||||||
this::class.simpleName == "IrLinkageError"
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
&& message == "Abstract property accessor $symbolName is not implemented in non-abstract class ${symbolName.substringBeforeLast(".")}"
|
|
||||||
|
val expectedMessage = "Abstract property accessor $symbolName is not implemented in non-abstract class $className"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (expectedMessage == actualMessage)
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessage, ACTUAL: $actualMessage"
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,16 +4,23 @@ import lib2.B
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a: A = B()
|
val a: A = B()
|
||||||
|
|
||||||
try {
|
return try {
|
||||||
val answer: Int = a.foo // <-- should throw linkage error here
|
val answer: Int = a.foo // <-- should throw linkage error here
|
||||||
println(answer)
|
println(answer)
|
||||||
|
"FAIL"
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
if (e.isLinkageError("lib2.B.<get-foo>")) return "OK"
|
e.checkLinkageError("foo.<get-foo>", "B")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
private fun Throwable.checkLinkageError(symbolName: String, className: String): String {
|
||||||
this::class.simpleName == "IrLinkageError"
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
&& message == "Abstract property accessor $symbolName is not implemented in non-abstract class ${symbolName.substringBeforeLast(".")}"
|
|
||||||
|
val expectedMessage = "Abstract property accessor $symbolName is not implemented in non-abstract class $className"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (expectedMessage == actualMessage)
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessage, ACTUAL: $actualMessage"
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
try {
|
return try {
|
||||||
bar()
|
bar()
|
||||||
return "FAIL1"
|
"FAIL"
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
if (!e.isLinkageError("/Foo.<init>")) return "FAIL2"
|
e.checkLinkageError("constructor Foo.<init> can not be called")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "OK"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
private fun Throwable.checkLinkageError(prefix: String): String {
|
||||||
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked IR symbol $symbolName|") == true
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
|
|
||||||
|
val expectedMessagePrefix = "$prefix because it uses unlinked symbols"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (actualMessage.startsWith(expectedMessagePrefix))
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessagePrefix, ACTUAL: $actualMessage"
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class D {
|
class D {
|
||||||
fun stable(c: C): String = "K"
|
fun stable(c: C): String = "OK"
|
||||||
fun foo(): String = stable(C())
|
fun foo(): String = stable(C())
|
||||||
|
|
||||||
fun exp(e: E): String = "FAIL1"
|
fun exp(e: E): String = "FAIL1"
|
||||||
|
|||||||
@@ -1,20 +1,31 @@
|
|||||||
fun test1(d: D): String {
|
fun test1(d: D): String {
|
||||||
try {
|
return try {
|
||||||
d.bar()
|
d.bar()
|
||||||
} catch(e: Throwable) {
|
} catch(e: Throwable) {
|
||||||
if (e.isLinkageError("/E.<init>")) return "O"
|
e.checkLinkageError("constructor E.<init> can not be called")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL2"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test2(d: D): String {
|
fun test2(d: D): String {
|
||||||
return d.foo()
|
return d.foo()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String =checkResults(test1(D()), test2(D()))
|
||||||
return test1(D()) + test2(D())
|
|
||||||
|
private fun Throwable.checkLinkageError(prefix: String): String {
|
||||||
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
|
|
||||||
|
val expectedMessagePrefix = "$prefix because it uses unlinked symbols"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (actualMessage.startsWith(expectedMessagePrefix))
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessagePrefix, ACTUAL: $actualMessage"
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
private fun checkResults(vararg results: String): String = when {
|
||||||
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked IR symbol $symbolName|") == true
|
results.isEmpty() -> "no results to check"
|
||||||
|
results.all { it == "OK" } -> "OK"
|
||||||
|
else -> results.joinToString("\n")
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
class C {
|
class C {
|
||||||
fun o(): String = "O"
|
fun o(): String = "FAIL1"
|
||||||
val op: String get() = "O"
|
val op: String get() = "FAIL2"
|
||||||
}
|
}
|
||||||
|
|
||||||
class E {
|
class E {
|
||||||
fun e(): String = "FAIL1"
|
fun e(): String = "FAIL3"
|
||||||
val ep: String get() = "FAIL2"
|
val ep: String get() = "FAIL4"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class C {
|
class C {
|
||||||
fun o(): String = "K"
|
fun o(): String = "OK"
|
||||||
val op: String get() = "K"
|
val op: String get() = "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,3 +19,45 @@ class D2 {
|
|||||||
val expP2: E = E()
|
val expP2: E = E()
|
||||||
val barP2: String = expP2.ep
|
val barP2: String = expP2.ep
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
fun foo(): E = E()
|
||||||
|
foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun baz() {
|
||||||
|
fun qux() {
|
||||||
|
fun foo(): E = E()
|
||||||
|
foo()
|
||||||
|
}
|
||||||
|
qux()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun quux() {
|
||||||
|
class Local {
|
||||||
|
fun corge() {
|
||||||
|
fun foo(): E = E()
|
||||||
|
foo()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Local().corge()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun grault() {
|
||||||
|
object {
|
||||||
|
fun garply() {
|
||||||
|
fun foo(): E = E()
|
||||||
|
foo()
|
||||||
|
}
|
||||||
|
}.garply()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun waldo() {
|
||||||
|
val fred = object {
|
||||||
|
fun garply() {
|
||||||
|
fun foo(): E = E()
|
||||||
|
foo()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fred.garply()
|
||||||
|
}
|
||||||
|
|||||||
+68
-18
@@ -1,11 +1,9 @@
|
|||||||
fun test1(d: D): String {
|
fun test1(d: D): String {
|
||||||
try {
|
return try {
|
||||||
d.barF()
|
d.barF()
|
||||||
} catch(e: Throwable) {
|
} catch(e: Throwable) {
|
||||||
if (e.isLinkageError("/D.expF")) return "O"
|
e.checkLinkageError("function expF can not be called")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL3"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test2(d: D): String {
|
fun test2(d: D): String {
|
||||||
@@ -13,13 +11,11 @@ fun test2(d: D): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun test3(d: D): String {
|
fun test3(d: D): String {
|
||||||
try {
|
return try {
|
||||||
d.barP1
|
d.barP1
|
||||||
} catch(e: Throwable) {
|
} catch(e: Throwable) {
|
||||||
if (e.isLinkageError("/D.expP1.<get-expP1>")) return "O"
|
e.checkLinkageError("property accessor expP1.<get-expP1> can not be called")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL4"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test4(d: D): String {
|
fun test4(d: D): String {
|
||||||
@@ -27,20 +23,74 @@ fun test4(d: D): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun test5(): String {
|
fun test5(): String {
|
||||||
try {
|
return try {
|
||||||
D2().barP2
|
D2().barP2
|
||||||
} catch(e: Throwable) {
|
} catch(e: Throwable) {
|
||||||
if (e.isLinkageError("/D2.expP2.<get-expP2>")) return "OK"
|
e.checkLinkageError("property accessor expP2.<get-expP2> can not be called")
|
||||||
else throw e
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL5"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun test6(): String {
|
||||||
val result = test1(D()) + test2(D()) + test3(D()) + test4(D()) + test5()
|
return try {
|
||||||
return if (result == "OKOKOK") "OK" else result
|
bar()
|
||||||
|
return "FAIL6"
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.checkLinkageError("function foo can not be called")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
fun test7(): String {
|
||||||
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked type in signature of IR symbol $symbolName|") == true
|
return try {
|
||||||
|
baz()
|
||||||
|
return "FAIL7"
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.checkLinkageError("function foo can not be called")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test8(): String {
|
||||||
|
return try {
|
||||||
|
quux()
|
||||||
|
return "FAIL8"
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.checkLinkageError("function foo can not be called")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test9(): String {
|
||||||
|
return try {
|
||||||
|
grault()
|
||||||
|
return "FAIL9"
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.checkLinkageError("function foo can not be called")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test10(): String {
|
||||||
|
return try {
|
||||||
|
waldo()
|
||||||
|
return "FAIL10"
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.checkLinkageError("function foo can not be called")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String = checkResults(test1(D()), test2(D()), test3(D()), test4(D()), test5(), test6(), test7(), test8(), test9(), test10())
|
||||||
|
|
||||||
|
private fun Throwable.checkLinkageError(prefix: String): String {
|
||||||
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
|
|
||||||
|
val expectedMessagePrefix = "$prefix because it uses unlinked symbols"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (actualMessage.startsWith(expectedMessagePrefix))
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessagePrefix, ACTUAL: $actualMessage"
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkResults(vararg results: String): String = when {
|
||||||
|
results.isEmpty() -> "no results to check"
|
||||||
|
results.all { it == "OK" } -> "OK"
|
||||||
|
else -> results.joinToString("\n")
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class C {
|
class C {
|
||||||
fun o(): String = "K"
|
fun o(): String = "FAIL1"
|
||||||
}
|
}
|
||||||
|
|
||||||
class E {
|
class E {
|
||||||
fun e(): String = "FAIL"
|
fun e(): String = "FAIL2"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
class C {
|
class C {
|
||||||
fun o(): String = "K"
|
fun o(): String = "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,31 @@
|
|||||||
fun test1(d: D): String {
|
fun test1(d: D): String {
|
||||||
try {
|
return try {
|
||||||
d.bar()
|
d.bar()
|
||||||
} catch(e: Throwable) {
|
} catch(e: Throwable) {
|
||||||
if (e.isLinkageError("/D.exp")) return "O"
|
e.checkLinkageError("function exp can not be called")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL2"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test2(d: D): String {
|
fun test2(d: D): String {
|
||||||
return d.foo()
|
return d.foo()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String = checkResults(test1(D()), test2(D()))
|
||||||
return test1(D()) + test2(D())
|
|
||||||
|
private fun Throwable.checkLinkageError(prefix: String): String {
|
||||||
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
|
|
||||||
|
val expectedMessagePrefix = "$prefix because it uses unlinked symbols"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (actualMessage.startsWith(expectedMessagePrefix))
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessagePrefix, ACTUAL: $actualMessage"
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
private fun checkResults(vararg results: String): String = when {
|
||||||
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked type in signature of IR symbol $symbolName|") == true
|
results.isEmpty() -> "no results to check"
|
||||||
|
results.all { it == "OK" } -> "OK"
|
||||||
|
else -> results.joinToString("\n")
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class C {
|
class C {
|
||||||
fun o(): String = "K"
|
fun o(): String = "FAIL1"
|
||||||
}
|
}
|
||||||
|
|
||||||
class E {
|
class E {
|
||||||
fun e(): String = "FAIL"
|
fun e(): String = "FAIL2"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
class C {
|
class C {
|
||||||
fun o(): String = "K"
|
fun o(): String = "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,31 @@
|
|||||||
fun test1(d: D): String {
|
fun test1(d: D): String {
|
||||||
try {
|
return try {
|
||||||
d.bar()
|
d.bar()
|
||||||
} catch(e: Throwable) {
|
} catch(e: Throwable) {
|
||||||
if (e.isLinkageError("/D.exp")) return "O"
|
e.checkLinkageError("function exp can not be called")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL2"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test2(d: D): String {
|
fun test2(d: D): String {
|
||||||
return d.foo()
|
return d.foo()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String =checkResults(test1(D()), test2(D()))
|
||||||
return test1(D()) + test2(D())
|
|
||||||
|
private fun Throwable.checkLinkageError(prefix: String): String {
|
||||||
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
|
|
||||||
|
val expectedMessagePrefix = "$prefix because it uses unlinked symbols"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (actualMessage.startsWith(expectedMessagePrefix))
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessagePrefix, ACTUAL: $actualMessage"
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
private fun checkResults(vararg results: String): String = when {
|
||||||
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked type in signature of IR symbol $symbolName|") == true
|
results.isEmpty() -> "no results to check"
|
||||||
|
results.all { it == "OK" } -> "OK"
|
||||||
|
else -> results.joinToString("\n")
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,3 +2,40 @@ fun bar() {
|
|||||||
var foo: Foo? = null
|
var foo: Foo? = null
|
||||||
check(foo == null)
|
check(foo == null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun baz() {
|
||||||
|
fun qux() {
|
||||||
|
var foo: Foo? = null
|
||||||
|
check(foo == null)
|
||||||
|
}
|
||||||
|
qux()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun quux() {
|
||||||
|
class Local {
|
||||||
|
fun corge() {
|
||||||
|
var foo: Foo? = null
|
||||||
|
check(foo == null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Local().corge()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun grault() {
|
||||||
|
object {
|
||||||
|
fun garply() {
|
||||||
|
var foo: Foo? = null
|
||||||
|
check(foo == null)
|
||||||
|
}
|
||||||
|
}.garply()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun waldo() {
|
||||||
|
val fred = object {
|
||||||
|
fun garply() {
|
||||||
|
var foo: Foo? = null
|
||||||
|
check(foo == null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fred.garply()
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,13 +1,64 @@
|
|||||||
fun box(): String {
|
fun test1(): String {
|
||||||
try {
|
return try {
|
||||||
bar()
|
bar()
|
||||||
return "FAIL1"
|
return "FAIL1"
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
if (!e.isLinkageError()) return "FAIL2"
|
e.checkLinkageError("var foo can not be read")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "OK"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(): Boolean =
|
fun test2(): String {
|
||||||
this::class.simpleName == "IrLinkageError" && message == "Unlinked type of IR expression"
|
return try {
|
||||||
|
baz()
|
||||||
|
return "FAIL2"
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.checkLinkageError("var foo can not be read")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test3(): String {
|
||||||
|
return try {
|
||||||
|
quux()
|
||||||
|
return "FAIL3"
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.checkLinkageError("var foo can not be read")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test4(): String {
|
||||||
|
return try {
|
||||||
|
grault()
|
||||||
|
return "FAIL4"
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.checkLinkageError("var foo can not be read")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test5(): String {
|
||||||
|
return try {
|
||||||
|
waldo()
|
||||||
|
return "FAIL5"
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.checkLinkageError("var foo can not be read")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() = checkResults(test1(), test2(), test3(), test4(), test5())
|
||||||
|
|
||||||
|
private fun Throwable.checkLinkageError(prefix: String): String {
|
||||||
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
|
|
||||||
|
val expectedMessagePrefix = "$prefix because it uses unlinked symbols"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (actualMessage.startsWith(expectedMessagePrefix))
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessagePrefix, ACTUAL: $actualMessage"
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkResults(vararg results: String): String = when {
|
||||||
|
results.isEmpty() -> "no results to check"
|
||||||
|
results.all { it == "OK" } -> "OK"
|
||||||
|
else -> results.joinToString("\n")
|
||||||
|
}
|
||||||
|
|||||||
+23
-15
@@ -1,31 +1,39 @@
|
|||||||
fun test1(): String {
|
fun test1(): String {
|
||||||
try {
|
return try {
|
||||||
return qux(true)
|
qux(true)
|
||||||
} catch(e: Throwable) {
|
} catch(e: Throwable) {
|
||||||
if (e.isLinkageError("/exp_foo")) return "OK"
|
e.checkLinkageError("function exp_foo can not be called")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL5"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test2(): String = qux(false)
|
fun test2(): String = qux(false)
|
||||||
|
|
||||||
fun test3(): String {
|
fun test3(): String {
|
||||||
try {
|
return try {
|
||||||
return qux2(true)
|
qux2(true)
|
||||||
} catch(e: Throwable) {
|
} catch(e: Throwable) {
|
||||||
if (e.isLinkageError("/A.exp_foo")) return "OK"
|
e.checkLinkageError("function exp_foo can not be called")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL6"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test4(): String = qux2(false)
|
fun test4(): String = qux2(false)
|
||||||
|
|
||||||
fun box(): String {
|
fun box() = checkResults(test1(), test2(), test3(), test4())
|
||||||
val result = test1() + test2() + test3() + test4()
|
|
||||||
return if (result == "OKOKOKOK") "OK" else result
|
private fun Throwable.checkLinkageError(prefix: String): String {
|
||||||
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
|
|
||||||
|
val expectedMessagePrefix = "$prefix because it uses unlinked symbols"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (actualMessage.startsWith(expectedMessagePrefix))
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessagePrefix, ACTUAL: $actualMessage"
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
private fun checkResults(vararg results: String): String = when {
|
||||||
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked IR symbol $symbolName|") == true
|
results.isEmpty() -> "no results to check"
|
||||||
|
results.all { it == "OK" } -> "OK"
|
||||||
|
else -> results.joinToString("\n")
|
||||||
|
}
|
||||||
|
|||||||
+75
-54
@@ -1,61 +1,82 @@
|
|||||||
fun box(): String {
|
fun test1(): String {
|
||||||
try {
|
return try {
|
||||||
fooVariableType()
|
fooVariableType()
|
||||||
return "FAIL1"
|
"FAIL1"
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
if (!e.isUnlinkedTypeOfExpression()) return "FAIL2"
|
e.checkLinkageError("val foo can not be read")
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
barVariableType()
|
|
||||||
return "FAIL3"
|
|
||||||
} catch (e: Throwable) {
|
|
||||||
if (!e.isUnlinkedTypeOfExpression()) return "FAIL4"
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
fooInstance()
|
|
||||||
return "FAIL5"
|
|
||||||
} catch(e: Throwable) {
|
|
||||||
if (!e.isUnlinkedSymbolLinkageError("/Foo.<init>")) return "FAIL6"
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
barInstance()
|
|
||||||
return "FAIL7"
|
|
||||||
} catch(e: Throwable) {
|
|
||||||
if (!e.isUnlinkedTypeInSignature("/Bar.<init>")) return "FAIL8"
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
fooInstance2()
|
|
||||||
return "FAIL9"
|
|
||||||
} catch(e: Throwable) {
|
|
||||||
if (!e.isUnlinkedSymbolLinkageError("/Foo.<init>")) return "FAIL10"
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
barInstance2()
|
|
||||||
return "FAIL11"
|
|
||||||
} catch(e: Throwable) {
|
|
||||||
if (!e.isUnlinkedTypeInSignature("/Bar.<init>")) return "FAIL12"
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
fooAnonymousObject()
|
|
||||||
return "FAIL13"
|
|
||||||
} catch(e: Throwable) {
|
|
||||||
if (!e.isUnlinkedTypeOfExpression()) return "FAIL14"
|
|
||||||
}
|
|
||||||
|
|
||||||
return "OK"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isUnlinkedTypeOfExpression(): Boolean =
|
fun test2(): String {
|
||||||
this::class.simpleName == "IrLinkageError" && message == "Unlinked type of IR expression"
|
return try {
|
||||||
|
barVariableType()
|
||||||
|
"FAIL2"
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.checkLinkageError("val bar can not be read")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun Throwable.isUnlinkedSymbolLinkageError(symbolName: String): Boolean =
|
fun test3(): String {
|
||||||
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked IR symbol $symbolName|") == true
|
return try {
|
||||||
|
fooInstance()
|
||||||
|
"FAIL3"
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.checkLinkageError("constructor Foo.<init> can not be called")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun Throwable.isUnlinkedTypeInSignature(symbolName: String): Boolean =
|
fun test4(): String {
|
||||||
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked type in signature of IR symbol $symbolName|") == true
|
return try {
|
||||||
|
barInstance()
|
||||||
|
"FAIL4"
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.checkLinkageError("constructor Bar.<init> can not be called")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test5(): String {
|
||||||
|
return try {
|
||||||
|
fooInstance2()
|
||||||
|
"FAIL5"
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.checkLinkageError("reference to constructor Foo.<init> can not be evaluated")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test6(): String {
|
||||||
|
return try {
|
||||||
|
barInstance2()
|
||||||
|
"FAIL6"
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.checkLinkageError("reference to constructor Bar.<init> can not be evaluated")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test7(): String {
|
||||||
|
return try {
|
||||||
|
fooAnonymousObject()
|
||||||
|
"FAIL7"
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.checkLinkageError("val foo can not be read")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String = checkResults(test1(), test2(), test3(), test4(), test5(), test6(), test7())
|
||||||
|
|
||||||
|
private fun Throwable.checkLinkageError(prefix: String): String {
|
||||||
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
|
|
||||||
|
val expectedMessagePrefix = "$prefix because it uses unlinked symbols"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (actualMessage.startsWith(expectedMessagePrefix))
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessagePrefix, ACTUAL: $actualMessage"
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkResults(vararg results: String): String = when {
|
||||||
|
results.isEmpty() -> "no results to check"
|
||||||
|
results.all { it == "OK" } -> "OK"
|
||||||
|
else -> results.joinToString("\n")
|
||||||
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
fun foo() = "FAIL1"
|
fun foo() = "FAIL"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
// fun foo() = "FAIL1"
|
// fun foo() = "FAIL"
|
||||||
|
|||||||
+14
-7
@@ -1,12 +1,19 @@
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
try {
|
return try {
|
||||||
return bar()
|
bar()
|
||||||
} catch(e: Throwable) {
|
} catch(e: Throwable) {
|
||||||
if (e.isLinkageError("/foo")) return "OK"
|
e.checkLinkageError("function foo can not be called")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL2"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
private fun Throwable.checkLinkageError(prefix: String): String {
|
||||||
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked IR symbol $symbolName|") == true
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
|
|
||||||
|
val expectedMessagePrefix = "$prefix because it uses unlinked symbols"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (actualMessage.startsWith(expectedMessagePrefix))
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessagePrefix, ACTUAL: $actualMessage"
|
||||||
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
val foo: String get() = "FAIL1"
|
val foo: String get() = "FAIL"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
// val foo: String get() = "FAIL1"
|
// val foo: String get() = "FAIL"
|
||||||
|
|||||||
+14
-7
@@ -1,12 +1,19 @@
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
try {
|
return try {
|
||||||
return bar()
|
bar()
|
||||||
} catch(e: Throwable) {
|
} catch(e: Throwable) {
|
||||||
if (e.isLinkageError("/foo.<get-foo>")) return "OK"
|
e.checkLinkageError("property accessor foo.<get-foo> can not be called")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL2"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
private fun Throwable.checkLinkageError(prefix: String): String {
|
||||||
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked IR symbol $symbolName|") == true
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
|
|
||||||
|
val expectedMessagePrefix = "$prefix because it uses unlinked symbols"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (actualMessage.startsWith(expectedMessagePrefix))
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessagePrefix, ACTUAL: $actualMessage"
|
||||||
|
}
|
||||||
|
|||||||
+25
-19
@@ -1,43 +1,49 @@
|
|||||||
fun test1(): String {
|
fun test1(): String {
|
||||||
try {
|
return try {
|
||||||
return qux(true)
|
qux(true)
|
||||||
} catch(e: Throwable) {
|
} catch(e: Throwable) {
|
||||||
if (e.isLinkageError("/exp_foo.<get-exp_foo>")) return "OK"
|
e.checkLinkageError("property accessor exp_foo.<get-exp_foo> can not be called")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL7"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test2(): String = qux(false)
|
fun test2(): String = qux(false)
|
||||||
|
|
||||||
fun test3(): String {
|
fun test3(): String {
|
||||||
try {
|
return try {
|
||||||
return qux2(true)
|
qux2(true)
|
||||||
} catch(e: Throwable) {
|
} catch(e: Throwable) {
|
||||||
if (e.isLinkageError("/A.exp_foo.<get-exp_foo>")) return "OK"
|
e.checkLinkageError("property accessor exp_foo.<get-exp_foo> can not be called")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL8"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test4(): String = qux2(false)
|
fun test4(): String = qux2(false)
|
||||||
|
|
||||||
fun test5(): String {
|
fun test5(): String {
|
||||||
try {
|
return try {
|
||||||
return qux3(true)
|
return qux3(true)
|
||||||
} catch(e: Throwable) {
|
} catch(e: Throwable) {
|
||||||
if (e.isLinkageError("/B.exp_foo.<get-exp_foo>")) return "OK"
|
e.checkLinkageError("property accessor exp_foo.<get-exp_foo> can not be called")
|
||||||
}
|
}
|
||||||
|
|
||||||
return "FAIL9"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test6(): String = qux3(false)
|
fun test6(): String = qux3(false)
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String = checkResults(test1(), test2(), test3(), test4(), test5(), test6())
|
||||||
val result = test1() + test2() + test3() + test4() + test5() + test6()
|
|
||||||
return if (result == "OKOKOKOKOKOK") "OK" else result
|
private fun Throwable.checkLinkageError(prefix: String): String {
|
||||||
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
|
|
||||||
|
val expectedMessagePrefix = "$prefix because it uses unlinked symbols"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (actualMessage.startsWith(expectedMessagePrefix))
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessagePrefix, ACTUAL: $actualMessage"
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
private fun checkResults(vararg results: String): String = when {
|
||||||
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked IR symbol $symbolName|") == true
|
results.isEmpty() -> "no results to check"
|
||||||
|
results.all { it == "OK" } -> "OK"
|
||||||
|
else -> results.joinToString("\n")
|
||||||
|
}
|
||||||
|
|||||||
+26
-11
@@ -1,13 +1,28 @@
|
|||||||
fun box(): String {
|
fun test1() = try {
|
||||||
try {
|
callFoo()
|
||||||
callFoo()
|
"FAIL"
|
||||||
return "FAIL1"
|
} catch (e: Throwable) {
|
||||||
} catch(e: Throwable) {
|
e.checkLinkageError("function foo can not be called")
|
||||||
if (!e.isLinkageError("/foo")) return "FAIL2"
|
|
||||||
}
|
|
||||||
|
|
||||||
return bar()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Throwable.isLinkageError(symbolName: String): Boolean =
|
fun test2() = bar()
|
||||||
this::class.simpleName == "IrLinkageError" && message?.startsWith("Unlinked IR symbol $symbolName|") == true
|
|
||||||
|
fun box(): String = checkResults(test1(), test2())
|
||||||
|
|
||||||
|
private fun Throwable.checkLinkageError(prefix: String): String {
|
||||||
|
if (this::class.simpleName != "IrLinkageError") return "Unexpected throwable: ${this::class}"
|
||||||
|
|
||||||
|
val expectedMessagePrefix = "$prefix because it uses unlinked symbols"
|
||||||
|
val actualMessage = message.orEmpty()
|
||||||
|
|
||||||
|
return if (actualMessage.startsWith(expectedMessagePrefix))
|
||||||
|
"OK"
|
||||||
|
else
|
||||||
|
"EXPECTED: $expectedMessagePrefix, ACTUAL: $actualMessage"
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkResults(vararg results: String): String = when {
|
||||||
|
results.isEmpty() -> "no results to check"
|
||||||
|
results.all { it == "OK" } -> "OK"
|
||||||
|
else -> results.joinToString("\n")
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user