[JS IR] Add test on interface with default method calling extension method on super-interface

^KT-42176 fixed
This commit is contained in:
Ilya Goncharov
2021-01-18 18:24:19 +03:00
parent 5c28762c02
commit 50ab9ed054
10 changed files with 130 additions and 0 deletions
@@ -13178,6 +13178,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("classMethodCallExtensionSuper.kt")
public void testClassMethodCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/classMethodCallExtensionSuper.kt");
}
@Test
@TestMetadata("defaultMethodInterfaceCallExtensionSuper.kt")
public void testDefaultMethodInterfaceCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/defaultMethodInterfaceCallExtensionSuper.kt");
}
@Test
@TestMetadata("executionOrder.kt")
public void testExecutionOrder() throws Exception {
@@ -0,0 +1,22 @@
// KT-42176
interface Top<D>{
fun getData(): D
fun toString(data: D): String
}
fun <D> Top<D>.getString() = toString(getData())
abstract class DefaultImpl: Top<Int>{
override fun toString(data: Int): String = data.toString()
}
class Bottom(val data: Int): DefaultImpl {
override fun getData(): Int = data
}
fun box(): String {
val bottom = Bottom(10).getString()
if (bottom != "10") return "fail: $bottom"
return "OK"
}
@@ -0,0 +1,22 @@
// KT-42176
interface Top<D>{
fun getData(): D
fun toString(data: D): String
}
fun <D> Top<D>.getString() = toString(getData())
interface DefaultImpl: Top<Int>{
override fun toString(data: Int): String = data.toString()
}
class Bottom(val data: Int): DefaultImpl {
override fun getData(): Int = data
}
fun box(): String {
val bottom = Bottom(10).getString()
if (bottom != "10") return "fail: $bottom"
return "OK"
}
@@ -13178,6 +13178,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Test
@TestMetadata("classMethodCallExtensionSuper.kt")
public void testClassMethodCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/classMethodCallExtensionSuper.kt");
}
@Test
@TestMetadata("defaultMethodInterfaceCallExtensionSuper.kt")
public void testDefaultMethodInterfaceCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/defaultMethodInterfaceCallExtensionSuper.kt");
}
@Test
@TestMetadata("executionOrder.kt")
public void testExecutionOrder() throws Exception {
@@ -13178,6 +13178,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("classMethodCallExtensionSuper.kt")
public void testClassMethodCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/classMethodCallExtensionSuper.kt");
}
@Test
@TestMetadata("defaultMethodInterfaceCallExtensionSuper.kt")
public void testDefaultMethodInterfaceCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/defaultMethodInterfaceCallExtensionSuper.kt");
}
@Test
@TestMetadata("executionOrder.kt")
public void testExecutionOrder() throws Exception {
@@ -11574,6 +11574,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("classMethodCallExtensionSuper.kt")
public void testClassMethodCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/classMethodCallExtensionSuper.kt");
}
@TestMetadata("defaultMethodInterfaceCallExtensionSuper.kt")
public void testDefaultMethodInterfaceCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/defaultMethodInterfaceCallExtensionSuper.kt");
}
@TestMetadata("executionOrder.kt")
public void testExecutionOrder() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/executionOrder.kt");
@@ -9874,6 +9874,16 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
@TestMetadata("classMethodCallExtensionSuper.kt")
public void testClassMethodCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/classMethodCallExtensionSuper.kt");
}
@TestMetadata("defaultMethodInterfaceCallExtensionSuper.kt")
public void testDefaultMethodInterfaceCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/defaultMethodInterfaceCallExtensionSuper.kt");
}
@TestMetadata("executionOrder.kt")
public void testExecutionOrder() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/executionOrder.kt");
@@ -9874,6 +9874,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@TestMetadata("classMethodCallExtensionSuper.kt")
public void testClassMethodCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/classMethodCallExtensionSuper.kt");
}
@TestMetadata("defaultMethodInterfaceCallExtensionSuper.kt")
public void testDefaultMethodInterfaceCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/defaultMethodInterfaceCallExtensionSuper.kt");
}
@TestMetadata("executionOrder.kt")
public void testExecutionOrder() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/executionOrder.kt");
@@ -9874,6 +9874,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@TestMetadata("classMethodCallExtensionSuper.kt")
public void testClassMethodCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/classMethodCallExtensionSuper.kt");
}
@TestMetadata("defaultMethodInterfaceCallExtensionSuper.kt")
public void testDefaultMethodInterfaceCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/defaultMethodInterfaceCallExtensionSuper.kt");
}
@TestMetadata("executionOrder.kt")
public void testExecutionOrder() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/executionOrder.kt");
@@ -4913,6 +4913,16 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@TestMetadata("classMethodCallExtensionSuper.kt")
public void testClassMethodCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/classMethodCallExtensionSuper.kt");
}
@TestMetadata("defaultMethodInterfaceCallExtensionSuper.kt")
public void testDefaultMethodInterfaceCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/defaultMethodInterfaceCallExtensionSuper.kt");
}
@TestMetadata("executionOrder.kt")
public void testExecutionOrder() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/executionOrder.kt");