From 8d2b1950e684676c353016582b65d349954af2e5 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Thu, 20 Sep 2018 12:40:01 +0300 Subject: [PATCH] Fix Kotlin default interface methods calls for inline classes When mapping callable method signature for erased inline class methods, use original function descriptor instead of super declaration (otherwise it would map to a default interface method with mismatching signature). When generating delegates to Kotlin default interface methods, keep track of the original Kotlin types for delegating method arguments and interface method arguments. 'original' for value parameters of fake overrides points to the overridden function value parameters instead of the value parameter of the unsubstituted function. This causes inconsistent type mapping for inline classes implementing generic interfaces with default methods. #KT-25295 Fixed Target versions 1.3.20 #KT-26931 Fixed Target versions 1.3.20 --- .../jetbrains/kotlin/codegen/CallGenerator.kt | 5 +- .../kotlin/codegen/ClassBodyCodegen.java | 57 ++++++++++++++++--- .../codegen/ErasedInlineClassBodyCodegen.kt | 1 + .../codegen/state/KotlinTypeMapper.java | 2 +- .../defaultInterfaceExtensionFunCall.kt | 39 +++++++++++++ .../defaultInterfaceMethodCall.kt | 27 +++++++++ .../genericDefaultInterfaceMethodCall.kt | 14 +++++ .../genericInterfaceMethodCall.kt | 13 +++++ .../overriddenDefaultInterfaceMethodCall.kt | 24 ++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 38 +++++++++++++ .../LightAnalysisModeTestGenerated.java | 38 +++++++++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 38 +++++++++++++ .../IrJsCodegenBoxTestGenerated.java | 38 +++++++++++++ .../semantics/JsCodegenBoxTestGenerated.java | 38 +++++++++++++ 14 files changed, 363 insertions(+), 9 deletions(-) create mode 100644 compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceExtensionFunCall.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceMethodCall.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceMethodCall.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericInterfaceMethodCall.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/overriddenDefaultInterfaceMethodCall.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/CallGenerator.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/CallGenerator.kt index fa4d5c98c30..58c4b8bfc87 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/CallGenerator.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/CallGenerator.kt @@ -66,13 +66,16 @@ interface CallGenerator { } val value = codegen.gen(argumentExpression) - value.put(parameterType, valueParameterDescriptor.original.type, v) + value.put(parameterType, valueParameterDescriptor.unsubstitutedType, v) if (isVarargInvoke) { v.astore(OBJECT_TYPE) } } + private val ValueParameterDescriptor.unsubstitutedType + get() = containingDeclaration.original.valueParameters[index].type + override fun putCapturedValueOnStack(stackValue: StackValue, valueType: Type, paramIndex: Int) { stackValue.put(stackValue.type, stackValue.kotlinType, codegen.v) } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBodyCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBodyCodegen.java index 74e5e99cb40..79c4f4571eb 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBodyCodegen.java @@ -20,10 +20,12 @@ import org.jetbrains.kotlin.psi.synthetics.SyntheticClassOrObjectDescriptor; import org.jetbrains.kotlin.psi.synthetics.SyntheticClassOrObjectDescriptorKt; import org.jetbrains.kotlin.resolve.BindingContext; import org.jetbrains.kotlin.resolve.DescriptorUtils; +import org.jetbrains.kotlin.resolve.InlineClassesUtilsKt; import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature; import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter; import org.jetbrains.kotlin.resolve.scopes.MemberScope; +import org.jetbrains.kotlin.types.KotlinType; import org.jetbrains.org.objectweb.asm.Type; import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter; import org.jetbrains.org.objectweb.asm.commons.Method; @@ -274,15 +276,56 @@ public abstract class ClassBodyCodegen extends MemberCodegen argsDescriptors = getParameters(inheritedFun); + List originalArgsDescriptors = getParameters(interfaceFun); + assert argsDescriptors.size() == originalArgsDescriptors.size() : + "Inconsistent value parameters between delegating fun " + inheritedFun + + "and interface fun " + interfaceFun; + + Iterator argsIterator = argsDescriptors.iterator(); + Iterator originalArgsIterator = originalArgsDescriptors.iterator(); + for (; argI < argTypes.length; argI++, originalArgI++) { + Type argType = argTypes[argI]; + KotlinType argKotlinType = argsIterator.next().getType(); + + Type originalArgType = originalArgTypes[originalArgI]; + KotlinType originalArgKotlinType = originalArgsIterator.next().getType(); + + StackValue.local(reg, argType, argKotlinType) + .put(originalArgType, originalArgKotlinType, iv); + reg += argType.getSize(); } + + assert originalArgI == originalArgTypes.length : + "Invalid trait implementation signature: " + signature + " vs " + traitMethod + " for " + interfaceFun; + } + + private List getParameters(FunctionDescriptor functionDescriptor) { + List valueParameterDescriptors = + new ArrayList<>(functionDescriptor.getValueParameters().size() + 1); + + ReceiverParameterDescriptor extensionReceiverParameter = functionDescriptor.getExtensionReceiverParameter(); + if (extensionReceiverParameter != null) { + valueParameterDescriptors.add(extensionReceiverParameter); + } + + valueParameterDescriptors.addAll(functionDescriptor.getValueParameters()); + + return valueParameterDescriptors; } } ); diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ErasedInlineClassBodyCodegen.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/ErasedInlineClassBodyCodegen.kt index 15101876f56..b75b1d97820 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ErasedInlineClassBodyCodegen.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ErasedInlineClassBodyCodegen.kt @@ -49,6 +49,7 @@ class ErasedInlineClassBodyCodegen( override fun generateSyntheticPartsAfterBody() { super.generateSyntheticPartsAfterBody() + generateTraitMethods() generateUnboxMethod() generateFunctionsFromAny() generateSpecializedEqualsStub() diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java index a634ac55f22..0801e6d19e8 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java @@ -890,7 +890,7 @@ public class KotlinTypeMapper { : functionDescriptor.getOriginal(); signature = toInlinedErasedClass - ? mapSignatureForInlineErasedClassSkipGeneric(functionToCall) + ? mapSignatureForInlineErasedClassSkipGeneric(descriptor.getOriginal()) : mapSignatureSkipGeneric(functionToCall); returnKotlinType = functionToCall.getReturnType(); diff --git a/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceExtensionFunCall.kt b/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceExtensionFunCall.kt new file mode 100644 index 00000000000..bdebdbbe4e1 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceExtensionFunCall.kt @@ -0,0 +1,39 @@ +// !LANGUAGE: +InlineClasses +// IGNORE_BACKEND: JVM_IR + +interface IFoo { + fun Long.foo() = bar() + fun bar(): String +} + +inline class Z(val x: Int) : IFoo { + override fun bar(): String = "OK" +} + +inline class L(val x: Long) : IFoo { + override fun bar(): String = "OK" +} + +inline class S(val x: String) : IFoo { + override fun bar(): String = "OK" +} + +fun Z.testZ() { + if (1L.foo() != "OK") throw AssertionError() +} + +fun L.testL() { + if (1L.foo() != "OK") throw AssertionError() +} + +fun S.testS() { + if (1L.foo() != "OK") throw AssertionError() +} + +fun box(): String { + Z(42).testZ() + L(4L).testL() + S("").testS() + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceMethodCall.kt b/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceMethodCall.kt new file mode 100644 index 00000000000..e254533103f --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceMethodCall.kt @@ -0,0 +1,27 @@ +// !LANGUAGE: +InlineClasses +// IGNORE_BACKEND: JVM_IR + +interface IFoo { + fun foo() = bar() + fun bar(): String +} + +inline class Z(val x: Int) : IFoo { + override fun bar(): String = "OK" +} + +inline class L(val x: Long) : IFoo { + override fun bar(): String = "OK" +} + +inline class S(val x: String) : IFoo { + override fun bar(): String = "OK" +} + +fun box(): String { + if (Z(42).foo() != "OK") throw AssertionError() + if (L(4L).foo() != "OK") throw AssertionError() + if (S("").foo() != "OK") throw AssertionError() + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceMethodCall.kt b/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceMethodCall.kt new file mode 100644 index 00000000000..0757cd19094 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceMethodCall.kt @@ -0,0 +1,14 @@ +// !LANGUAGE: +InlineClasses +// IGNORE_BACKEND: JVM_IR + +interface IFoo> { + fun foo(t: T): String = t.bar() + fun bar(): String +} + +inline class Z(val x: Int) : IFoo { + override fun bar(): String = "OK" +} + +fun box(): String = + Z(1).foo(Z(2)) \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericInterfaceMethodCall.kt b/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericInterfaceMethodCall.kt new file mode 100644 index 00000000000..3e4ce13e9a4 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericInterfaceMethodCall.kt @@ -0,0 +1,13 @@ +// !LANGUAGE: +InlineClasses +// IGNORE_BACKEND: JVM_IR + +interface IFoo { + fun foo(x: T): String +} + +inline class Z(val x: Int) : IFoo { + override fun foo(x: Z) = "OK" +} + +fun box(): String = + Z(1).foo(Z(2)) \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/overriddenDefaultInterfaceMethodCall.kt b/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/overriddenDefaultInterfaceMethodCall.kt new file mode 100644 index 00000000000..6e10e535602 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/overriddenDefaultInterfaceMethodCall.kt @@ -0,0 +1,24 @@ +// !LANGUAGE: +InlineClasses +// IGNORE_BACKEND: JVM_IR + +interface IBase { + fun foo() = "BAD" +} + +interface IFoo : IBase { + override fun foo() = "OK" +} + +inline class Z(val x: Int) : IFoo + +inline class L(val x: Long) : IFoo + +inline class S(val x: String) : IFoo + +fun box(): String { + if (Z(42).foo() != "OK") throw AssertionError() + if (L(4L).foo() != "OK") throw AssertionError() + if (S("").foo() != "OK") throw AssertionError() + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 7905ddc954e..1787a082bae 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -12064,6 +12064,44 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/secondaryConstructor.kt"); } } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class InterfaceMethodCalls extends AbstractBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInInterfaceMethodCalls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); + } + + @TestMetadata("defaultInterfaceExtensionFunCall.kt") + public void testDefaultInterfaceExtensionFunCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceExtensionFunCall.kt"); + } + + @TestMetadata("defaultInterfaceMethodCall.kt") + public void testDefaultInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceMethodCall.kt"); + } + + @TestMetadata("genericDefaultInterfaceMethodCall.kt") + public void testGenericDefaultInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceMethodCall.kt"); + } + + @TestMetadata("genericInterfaceMethodCall.kt") + public void testGenericInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericInterfaceMethodCall.kt"); + } + + @TestMetadata("overriddenDefaultInterfaceMethodCall.kt") + public void testOverriddenDefaultInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/overriddenDefaultInterfaceMethodCall.kt"); + } + } } @TestMetadata("compiler/testData/codegen/box/innerNested") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 1d1d347bb94..8b0d01232c7 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -12064,6 +12064,44 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/secondaryConstructor.kt"); } } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class InterfaceMethodCalls extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInInterfaceMethodCalls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); + } + + @TestMetadata("defaultInterfaceExtensionFunCall.kt") + public void testDefaultInterfaceExtensionFunCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceExtensionFunCall.kt"); + } + + @TestMetadata("defaultInterfaceMethodCall.kt") + public void testDefaultInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceMethodCall.kt"); + } + + @TestMetadata("genericDefaultInterfaceMethodCall.kt") + public void testGenericDefaultInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceMethodCall.kt"); + } + + @TestMetadata("genericInterfaceMethodCall.kt") + public void testGenericInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericInterfaceMethodCall.kt"); + } + + @TestMetadata("overriddenDefaultInterfaceMethodCall.kt") + public void testOverriddenDefaultInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/overriddenDefaultInterfaceMethodCall.kt"); + } + } } @TestMetadata("compiler/testData/codegen/box/innerNested") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 3a3b0aa874b..474d741fec0 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -12069,6 +12069,44 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/secondaryConstructor.kt"); } } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class InterfaceMethodCalls extends AbstractIrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInInterfaceMethodCalls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true); + } + + @TestMetadata("defaultInterfaceExtensionFunCall.kt") + public void testDefaultInterfaceExtensionFunCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceExtensionFunCall.kt"); + } + + @TestMetadata("defaultInterfaceMethodCall.kt") + public void testDefaultInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceMethodCall.kt"); + } + + @TestMetadata("genericDefaultInterfaceMethodCall.kt") + public void testGenericDefaultInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceMethodCall.kt"); + } + + @TestMetadata("genericInterfaceMethodCall.kt") + public void testGenericInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericInterfaceMethodCall.kt"); + } + + @TestMetadata("overriddenDefaultInterfaceMethodCall.kt") + public void testOverriddenDefaultInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/overriddenDefaultInterfaceMethodCall.kt"); + } + } } @TestMetadata("compiler/testData/codegen/box/innerNested") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java index 392d2698615..6340158b6bc 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java @@ -10589,6 +10589,44 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/secondaryConstructor.kt"); } } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class InterfaceMethodCalls extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInInterfaceMethodCalls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true); + } + + @TestMetadata("defaultInterfaceExtensionFunCall.kt") + public void testDefaultInterfaceExtensionFunCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceExtensionFunCall.kt"); + } + + @TestMetadata("defaultInterfaceMethodCall.kt") + public void testDefaultInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceMethodCall.kt"); + } + + @TestMetadata("genericDefaultInterfaceMethodCall.kt") + public void testGenericDefaultInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceMethodCall.kt"); + } + + @TestMetadata("genericInterfaceMethodCall.kt") + public void testGenericInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericInterfaceMethodCall.kt"); + } + + @TestMetadata("overriddenDefaultInterfaceMethodCall.kt") + public void testOverriddenDefaultInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/overriddenDefaultInterfaceMethodCall.kt"); + } + } } @TestMetadata("compiler/testData/codegen/box/innerNested") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 3eb6ccb11b5..acb990ca969 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -11649,6 +11649,44 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/hiddenConstructor/secondaryConstructor.kt"); } } + + @TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class InterfaceMethodCalls extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInInterfaceMethodCalls() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true); + } + + @TestMetadata("defaultInterfaceExtensionFunCall.kt") + public void testDefaultInterfaceExtensionFunCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceExtensionFunCall.kt"); + } + + @TestMetadata("defaultInterfaceMethodCall.kt") + public void testDefaultInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/defaultInterfaceMethodCall.kt"); + } + + @TestMetadata("genericDefaultInterfaceMethodCall.kt") + public void testGenericDefaultInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericDefaultInterfaceMethodCall.kt"); + } + + @TestMetadata("genericInterfaceMethodCall.kt") + public void testGenericInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/genericInterfaceMethodCall.kt"); + } + + @TestMetadata("overriddenDefaultInterfaceMethodCall.kt") + public void testOverriddenDefaultInterfaceMethodCall() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls/overriddenDefaultInterfaceMethodCall.kt"); + } + } } @TestMetadata("compiler/testData/codegen/box/innerNested")