[IR][tests] Removal of class used as variable type and constructor call

This commit is contained in:
Dmitriy Dolovov
2022-06-08 23:07:51 +03:00
parent d5ded97ccb
commit ce04a24b26
18 changed files with 93 additions and 0 deletions
@@ -0,0 +1 @@
class Foo
@@ -0,0 +1 @@
//class Foo
@@ -0,0 +1,6 @@
STEP 0:
dependencies: stdlib
STEP 1:
dependencies: stdlib
modifications:
U : l1.kt.1 -> l1.kt
@@ -0,0 +1,3 @@
fun bar() {
check(Foo().toString() != "Bar")
}
@@ -0,0 +1,2 @@
STEP 0:
dependencies: stdlib, lib1
@@ -0,0 +1,13 @@
fun box(): String {
try {
bar()
return "FAIL1"
} catch (e: Throwable) {
if (!e.isLinkageError("/Foo.<init>")) return "FAIL2"
}
return "OK"
}
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
@@ -0,0 +1 @@
class Foo
@@ -0,0 +1 @@
//class Foo
@@ -0,0 +1,6 @@
STEP 0:
dependencies: stdlib
STEP 1:
dependencies: stdlib
modifications:
U : l1.kt.1 -> l1.kt
@@ -0,0 +1,4 @@
fun bar() {
var foo: Foo? = null
check(foo == null)
}
@@ -0,0 +1,2 @@
STEP 0:
dependencies: stdlib, lib1
@@ -0,0 +1,13 @@
fun box(): String {
try {
bar()
return "FAIL1"
} catch (e: Throwable) {
if (!e.isLinkageError()) return "FAIL2"
}
return "OK"
}
private fun Throwable.isLinkageError(): Boolean =
this::class.simpleName == "IrLinkageError" && message == "Unlinked type of IR expression"
@@ -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
@@ -50,6 +50,11 @@ public class JsKLibABITestCaseGenerated extends AbstractJsKLibABITestCase {
runTest("compiler/testData/klibABI/removeAbstractPropertyFromInterface/");
}
@TestMetadata("removeClassAsConstructorCall")
public void testRemoveClassAsConstructorCall() throws Exception {
runTest("compiler/testData/klibABI/removeClassAsConstructorCall/");
}
@TestMetadata("removeClassAsParameterType")
public void testRemoveClassAsParameterType() throws Exception {
runTest("compiler/testData/klibABI/removeClassAsParameterType/");
@@ -70,6 +75,11 @@ public class JsKLibABITestCaseGenerated extends AbstractJsKLibABITestCase {
runTest("compiler/testData/klibABI/removeClassAsTypeArgument/");
}
@TestMetadata("removeClassAsVariableType")
public void testRemoveClassAsVariableType() throws Exception {
runTest("compiler/testData/klibABI/removeClassAsVariableType/");
}
@TestMetadata("removeFunction")
public void testRemoveFunction() throws Exception {
runTest("compiler/testData/klibABI/removeFunction/");
@@ -48,6 +48,12 @@ public class KlibABITestGenerated extends AbstractNativeKlibABITest {
runTest("compiler/testData/klibABI/removeAbstractPropertyFromInterface/");
}
@Test
@TestMetadata("removeClassAsConstructorCall")
public void testRemoveClassAsConstructorCall() throws Exception {
runTest("compiler/testData/klibABI/removeClassAsConstructorCall/");
}
@Test
@TestMetadata("removeClassAsParameterType")
public void testRemoveClassAsParameterType() throws Exception {
@@ -72,6 +78,12 @@ public class KlibABITestGenerated extends AbstractNativeKlibABITest {
runTest("compiler/testData/klibABI/removeClassAsTypeArgument/");
}
@Test
@TestMetadata("removeClassAsVariableType")
public void testRemoveClassAsVariableType() throws Exception {
runTest("compiler/testData/klibABI/removeClassAsVariableType/");
}
@Test
@TestMetadata("removeFunction")
public void testRemoveFunction() throws Exception {