Fix codegen & bytecode tests after unifying exceptions in JVM backend

See KT-22275 for details
This commit is contained in:
Mikhail Zarechenskiy
2020-01-20 13:51:11 +03:00
parent 1ed7e33f42
commit 5c5635ce20
34 changed files with 55 additions and 55 deletions
@@ -15,7 +15,7 @@ private operator fun J.component2() = 2
fun use(x: Any) {}
fun box(): String {
assertFailsWith<IllegalArgumentException> {
assertFailsWith<NullPointerException> {
val (a, b) = J.j()
}
if (!component1Evaluated) return "component1 should be evaluated"
@@ -6,7 +6,7 @@ fun f(x: String) = "Fail 1"
fun box(): String {
return try {
f(J().s())
} catch (e: IllegalStateException) {
} catch (e: NullPointerException) {
if (e.message == "J().s() must not be null")
"OK"
else
@@ -8,11 +8,11 @@ public class Test {
try {
ExtensionKt.foo(null);
}
catch (IllegalArgumentException e) {
catch (NullPointerException e) {
try {
ExtensionKt.getBar(null);
}
catch (IllegalArgumentException f) {
catch (NullPointerException f) {
return "OK";
}
}
@@ -20,18 +20,18 @@ public class Test {
args[i] = null;
try {
f.invoke(args);
} catch (IllegalArgumentException e) {
} catch (NullPointerException e) {
// OK
continue;
} catch (Throwable e) {
throw new AssertionError(
"Incorrect exception (IllegalArgumentException expected): " + e.getClass().getName() + ", parameter index = " + i,
"Incorrect exception (NullPointerException expected): " + e.getClass().getName() + ", parameter index = " + i,
e
);
} finally {
args[i] = o;
}
throw new AssertionError("IllegalArgumentException expected, but nothing was thrown, parameter index = " + i);
throw new AssertionError("NullPointerException expected, but nothing was thrown, parameter index = " + i);
}
}
}
@@ -8,7 +8,7 @@ import kotlin.test.*
operator fun A.inc() = A()
fun box(): String {
assertFailsWith<IllegalArgumentException> {
assertFailsWith<NullPointerException> {
var aNull = A.n()
aNull++
}
@@ -8,7 +8,7 @@ import kotlin.test.*
private operator fun A.inc() = A()
fun box(): String {
assertFailsWith<IllegalArgumentException> {
assertFailsWith<NullPointerException> {
var aNull = A.n()
aNull++
}
@@ -16,7 +16,7 @@ public class F {
inline fun <T, U> expectAssertion(f: () -> (T) -> U): Unit? {
try {
F.passNull(f())
} catch (e: IllegalArgumentException) {
} catch (e: NullPointerException) {
return Unit
}
return null
@@ -10,7 +10,7 @@ class C : I
fun box() = try {
B.f()
"FAIL"
} catch (e: IllegalArgumentException) {
} catch (e: NullPointerException) {
"OK"
}
@@ -8,7 +8,7 @@ import kotlin.test.*
fun String.extension() {}
fun box(): String {
assertFailsWith<IllegalStateException> { J.s().extension() }
assertFailsWith<NullPointerException> { J.s().extension() }
return "OK"
}
@@ -8,7 +8,7 @@ import kotlin.test.*
inline fun String.extension() {}
fun box(): String {
assertFailsWith<IllegalStateException> {
assertFailsWith<NullPointerException> {
J.s().extension()
}
return "OK"
@@ -11,7 +11,7 @@ class C {
}
fun box(): String {
assertFailsWith<IllegalStateException> { C().test() }
assertFailsWith<NullPointerException> { C().test() }
return "OK"
}
@@ -11,7 +11,7 @@ class C {
}
fun box(): String {
assertFailsWith<IllegalStateException> {
assertFailsWith<NullPointerException> {
C().test()
}
return "OK"
@@ -17,11 +17,11 @@ fun box(): String {
try {
Test.callFoo()
return "Fail 1"
} catch (e : IllegalArgumentException) {
} catch (e: NullPointerException) {
if (e.message != "Parameter specified as non-null is null: method A.foo, parameter s") {
return "Fail 2 (message: ${e.message})"
}
} catch (e : Throwable) {
} catch (e: Throwable) {
return "Fail 3 (exception class: ${e::class.simpleName})"
}
return "OK"
@@ -6,7 +6,7 @@ fun f(x: String) = "Fail 1"
fun box(): String {
return try {
f(J.s())
} catch (e: IllegalStateException) {
} catch (e: NullPointerException) {
if (e.message == "J.s() must not be null" || e.message == "s() must not be null")
"OK"
else