[Native][tests] Add partial linkage tests (muted) for replacement-of-return-type case

^KT-51707
This commit is contained in:
Dmitriy Dolovov
2022-08-29 16:34:55 +02:00
parent 24d8ac97cd
commit 296c1cbd0f
11 changed files with 79 additions and 0 deletions
@@ -0,0 +1,14 @@
class Foo(val seed: Int) {
override fun toString() = "Foo[$seed]"
fun doCommon() = seed - 1
fun doSpecificFoo() = seed - 1
}
class Bar(val seed: Int) {
override fun toString() = "Bar[$seed]"
fun doCommon() = seed + 1
fun doSpecificBar() = seed + 1
}
val topLevelProperty = Foo(42)
fun topLevelFunction() = Foo(42)
@@ -0,0 +1,18 @@
// same
class Foo(val seed: Int) {
override fun toString() = "Foo[$seed]"
fun doCommon() = seed - 1
fun doSpecificFoo() = seed - 1
}
// same
class Bar(val seed: Int) {
override fun toString() = "Bar[$seed]"
fun doCommon() = seed + 1
fun doSpecificBar() = seed + 1
}
//val topLevelProperty = Foo(42)
val topLevelProperty = Bar(42)
//fun topLevelFunction() = Foo(42)
fun topLevelFunction() = Bar(42)
@@ -0,0 +1,6 @@
STEP 0:
dependencies: stdlib
STEP 1:
dependencies: stdlib
modifications:
U : l1.kt.1 -> l1.kt
@@ -0,0 +1,5 @@
fun doCommonViaProperty() = topLevelProperty.doCommon()
fun doSpecificViaProperty() = topLevelProperty.doSpecificFoo() // Because, initially topLevelProperty had type Foo.
fun doCommonViaFunction() = topLevelFunction().doCommon()
fun doSpecificViaFunction() = topLevelFunction().doSpecificFoo() // Because, initially topLevelFunction had return type Foo.
@@ -0,0 +1,2 @@
STEP 0:
dependencies: stdlib, lib1
@@ -0,0 +1,8 @@
import abitestutils.abiTest
fun box() = abiTest {
expectFailure(prefixed("???")) { doCommonViaProperty() }
expectFailure(prefixed("???")) { doSpecificViaProperty() }
expectFailure(prefixed("???")) { doCommonViaFunction() }
expectFailure(prefixed("???")) { doSpecificViaFunction() }
}
@@ -0,0 +1,2 @@
STEP 0:
dependencies: stdlib, lib1, lib2
@@ -0,0 +1,8 @@
MUTED
MODULES: lib1, lib2, main
STEP 0:
libs: lib1, lib2, main
STEP 1:
libs: lib1
@@ -145,6 +145,11 @@ public class JsKLibABINoICTestCaseGenerated extends AbstractJsKLibABINoICTestCas
runTest("compiler/testData/klibABI/removeProperty/");
}
@TestMetadata("replaceCallableReturnType")
public void testReplaceCallableReturnType() throws Exception {
runTest("compiler/testData/klibABI/replaceCallableReturnType/");
}
@TestMetadata("typeAliasRHSTypeChange")
public void testTypeAliasRHSTypeChange() throws Exception {
runTest("compiler/testData/klibABI/typeAliasRHSTypeChange/");
@@ -145,6 +145,11 @@ public class JsKLibABIWithICTestCaseGenerated extends AbstractJsKLibABIWithICTes
runTest("compiler/testData/klibABI/removeProperty/");
}
@TestMetadata("replaceCallableReturnType")
public void testReplaceCallableReturnType() throws Exception {
runTest("compiler/testData/klibABI/replaceCallableReturnType/");
}
@TestMetadata("typeAliasRHSTypeChange")
public void testTypeAliasRHSTypeChange() throws Exception {
runTest("compiler/testData/klibABI/typeAliasRHSTypeChange/");
@@ -162,6 +162,12 @@ public class KlibABITestGenerated extends AbstractNativeKlibABITest {
runTest("compiler/testData/klibABI/removeProperty/");
}
@Test
@TestMetadata("replaceCallableReturnType")
public void testReplaceCallableReturnType() throws Exception {
runTest("compiler/testData/klibABI/replaceCallableReturnType/");
}
@Test
@TestMetadata("typeAliasRHSTypeChange")
public void testTypeAliasRHSTypeChange() throws Exception {