diff --git a/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/SamType.kt b/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/SamType.kt index 5426b332d96..b2706480eec 100644 --- a/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/SamType.kt +++ b/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/SamType.kt @@ -9,8 +9,6 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor -import org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator -import org.jetbrains.kotlin.resolve.calls.commonSuperType import org.jetbrains.kotlin.resolve.sam.getAbstractMembers import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithNothing @@ -82,15 +80,7 @@ open class SamTypeFactory { } private fun KotlinType.removeExternalProjections(): KotlinType { - val newArguments = arguments.map { - val type = it.type - TypeProjectionImpl( - Variance.INVARIANT, - if (type.constructor is IntersectionTypeConstructor) - NewCommonSuperTypeCalculator.commonSuperType(type.constructor.supertypes.map(KotlinType::unwrap)) - else type - ) - } + val newArguments = arguments.map { TypeProjectionImpl(Variance.INVARIANT, it.type) } return replace(newArguments) } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java index cb4f1fc8d66..f4ecc1e718a 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java @@ -158,7 +158,14 @@ public class ClosureCodegen extends MemberCodegen { for (int i = 0; i < superInterfaceTypes.size(); i++) { KotlinType superInterfaceType = superInterfaceTypes.get(i); sw.writeInterface(); - superInterfaceAsmTypes[i] = typeMapper.mapSupertype(superInterfaceType, sw).getInternalName(); + Type superInterfaceAsmType; + if (samType != null && superInterfaceType.getConstructor() == samType.getType().getConstructor()) { + superInterfaceAsmType = typeMapper.mapSupertype(superInterfaceType, null); + sw.writeAsmType(superInterfaceAsmType); + } else { + superInterfaceAsmType = typeMapper.mapSupertype(superInterfaceType, sw); + } + superInterfaceAsmTypes[i] = superInterfaceAsmType.getInternalName(); sw.writeInterfaceEnd(); } diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index d92a7e6ca82..f6c0dbafab4 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -38084,6 +38084,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/sam/samConversionToJavaWildcard.kt"); } + @Test + @TestMetadata("samInterfaceTypeParameterErasure.kt") + public void testSamInterfaceTypeParameterErasure() throws Exception { + runTest("compiler/testData/codegen/box/sam/samInterfaceTypeParameterErasure.kt"); + } + @Test @TestMetadata("smartCastSamConversion.kt") public void testSmartCastSamConversion() throws Exception { diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt index af614b61cf0..8c1fca01650 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FunctionReferenceLowering.kt @@ -187,7 +187,11 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext) } } - return FunctionReferenceBuilder(reference, samSuperType).build() + // Erase generic arguments in the SAM type, because they are not easy to approximate correctly otherwise, + // and LambdaMetafactory also uses erased type. + val erasedSamSuperType = samSuperType.erasedUpperBound.rawType(context) + + return FunctionReferenceBuilder(reference, erasedSamSuperType).build() } private fun canGenerateIndySamConversionOnFunctionalExpression(samSuperType: IrType, expression: IrExpression): Boolean { diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/indy/LambdaMetafactoryArguments.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/indy/LambdaMetafactoryArguments.kt index 68a8fbd3fed..79c6f225a6d 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/indy/LambdaMetafactoryArguments.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/indy/LambdaMetafactoryArguments.kt @@ -29,6 +29,7 @@ import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.load.java.JvmAnnotationNames import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.utils.addIfNotNull internal class LambdaMetafactoryArguments( @@ -105,6 +106,12 @@ internal class LambdaMetafactoryArgumentsBuilder( if (implFun.parents.any { it.isInlineFunction() || it.isCrossinlineLambda() }) return null + // Don't try to use indy on SAM types with non-invariant projections because buildFakeOverrideMember doesn't support such supertypes + // (and rightly so: supertypes in Kotlin can't have projections in immediate type arguments). This can happen for example in case + // the SAM type is instantiated with an intersection type in arguments, which is approximated to an out-projection in psi2ir. + if (samType is IrSimpleType && samType.arguments.any { it is IrTypeProjection && it.variance != Variance.INVARIANT }) + return null + // Do the hard work of matching Kotlin functional interface hierarchy against LambdaMetafactory constraints. // Briefly: sometimes we have to force boxing on the primitive and inline class values, sometimes we have to keep them unboxed. // If this results in conflicting requirements, we can't use INVOKEDYNAMIC with LambdaMetafactory for creating a closure. diff --git a/compiler/testData/codegen/box/sam/adapters/genericSignature.kt b/compiler/testData/codegen/box/sam/adapters/genericSignature.kt index 5f5dacff672..d0a800bb8fc 100644 --- a/compiler/testData/codegen/box/sam/adapters/genericSignature.kt +++ b/compiler/testData/codegen/box/sam/adapters/genericSignature.kt @@ -18,6 +18,6 @@ class JavaClass { fun box(): String { val supertypes = JavaClass.foo { a, b -> a.compareTo(b) } - if (supertypes != "[java.util.Comparator]") return "Fail: $supertypes" + if (supertypes != "[interface java.util.Comparator]") return "Fail: $supertypes" return "OK" } diff --git a/compiler/testData/codegen/box/sam/contravariantIntersectionTypeWithNonTrivialCommonSupertype2.kt b/compiler/testData/codegen/box/sam/contravariantIntersectionTypeWithNonTrivialCommonSupertype2.kt index 66baa8ca875..d65b995e834 100644 --- a/compiler/testData/codegen/box/sam/contravariantIntersectionTypeWithNonTrivialCommonSupertype2.kt +++ b/compiler/testData/codegen/box/sam/contravariantIntersectionTypeWithNonTrivialCommonSupertype2.kt @@ -14,10 +14,6 @@ interface A : Top, Unrelated interface B : Top, Unrelated fun box(): String { - // TODO: https://youtrack.jetbrains.com/issue/KT-46238 - val version = System.getProperty("java.specification.version") - if (version != "1.6" && version != "1.8") return "OK" - val g = when ("".length) { 0 -> G() else -> G() diff --git a/compiler/testData/codegen/box/sam/kt11519.kt b/compiler/testData/codegen/box/sam/kt11519.kt index 4cf0692636d..e79018030a3 100644 --- a/compiler/testData/codegen/box/sam/kt11519.kt +++ b/compiler/testData/codegen/box/sam/kt11519.kt @@ -6,8 +6,9 @@ // FILE: Custom.java class Custom { - private K k; + static Class lambdaClass; + private K k; private V v; public Custom(K k, V v) { @@ -21,6 +22,7 @@ class Custom { public void forEach(MBiConsumer action) { action.accept(k, v); + lambdaClass = action.getClass(); } } @@ -36,8 +38,8 @@ fun box(): String { result = a + b } - val superInterfaces = Arrays.toString((Class.forName("_1Kt\$box$1")).genericInterfaces) - if (superInterfaces != "[Custom\$MBiConsumer]") { + val superInterfaces = Arrays.toString(Custom.lambdaClass.genericInterfaces) + if (superInterfaces != "[interface Custom\$MBiConsumer]") { return "fail: $superInterfaces" } diff --git a/compiler/testData/codegen/box/sam/kt11519Constructor.kt b/compiler/testData/codegen/box/sam/kt11519Constructor.kt index c57a48d4b62..2f62d394bbd 100644 --- a/compiler/testData/codegen/box/sam/kt11519Constructor.kt +++ b/compiler/testData/codegen/box/sam/kt11519Constructor.kt @@ -37,7 +37,7 @@ fun box(): String { }) val superInterfaces = Arrays.toString((Class.forName("_1Kt\$box$1")).genericInterfaces) - if (superInterfaces != "[Custom\$MBiConsumer]") { + if (superInterfaces != "[interface Custom\$MBiConsumer]") { return "fail: $superInterfaces" } diff --git a/compiler/testData/codegen/box/sam/kt11696.kt b/compiler/testData/codegen/box/sam/kt11696.kt index 08e5134b94c..ff70141ddc5 100644 --- a/compiler/testData/codegen/box/sam/kt11696.kt +++ b/compiler/testData/codegen/box/sam/kt11696.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME // SAM_CONVERSIONS: CLASS @@ -36,7 +35,7 @@ fun box(): String { } ) - if (result != "Consumer") return "fail: $result" + if (result != "interface Consumer") return "fail: $result" return "OK" } diff --git a/compiler/testData/codegen/box/sam/recordSubstitutedTypeForCallableSamParameter.kt b/compiler/testData/codegen/box/sam/recordSubstitutedTypeForCallableSamParameter.kt index 595ad2c364e..3a3faa15e88 100644 --- a/compiler/testData/codegen/box/sam/recordSubstitutedTypeForCallableSamParameter.kt +++ b/compiler/testData/codegen/box/sam/recordSubstitutedTypeForCallableSamParameter.kt @@ -26,7 +26,7 @@ private fun getFirstArgumentType(types: Array, klass: KClass<*>): String { .filterIsInstance() .firstOrNull { it.rawType == klass.java } ?.let { it.actualTypeArguments[0] } - ?.toString() ?: "fail, inferred type is null" + ?.toString() ?: "none" } class KtProvider : Provider() { @@ -89,5 +89,5 @@ fun box(): String { assertEquals(inferredTypeInSamLambda1, inferredTypeInSamLambda2) assertEquals(inferredTypeInSamLambda2, inferredTypeInSamLambda3) - return if (inferredTypeInSamLambda1 == "class java.lang.String") "OK" else "fail: $inferredTypeInSamLambda1" + return if (inferredTypeInSamLambda1 == "none") "OK" else "fail: $inferredTypeInSamLambda1" } diff --git a/compiler/testData/codegen/box/sam/samConstructorGenericSignature.kt b/compiler/testData/codegen/box/sam/samConstructorGenericSignature.kt index 81c2772b4e1..5b2fe3c5c7d 100644 --- a/compiler/testData/codegen/box/sam/samConstructorGenericSignature.kt +++ b/compiler/testData/codegen/box/sam/samConstructorGenericSignature.kt @@ -24,6 +24,6 @@ import java.util.Arrays fun box(): String { val r: JavaClass.Computable = JavaClass.Computable { "OK" } val supertypes = Arrays.toString(r.javaClass.getGenericInterfaces()) - if (supertypes != "[JavaClass\$Computable]") return "Fail: $supertypes" + if (supertypes != "[interface JavaClass\$Computable]") return "Fail: $supertypes" return JavaClass.compute(r)!! } diff --git a/compiler/testData/codegen/box/sam/samInterfaceTypeParameterErasure.kt b/compiler/testData/codegen/box/sam/samInterfaceTypeParameterErasure.kt new file mode 100644 index 00000000000..99b82c6b1dc --- /dev/null +++ b/compiler/testData/codegen/box/sam/samInterfaceTypeParameterErasure.kt @@ -0,0 +1,24 @@ +// TARGET_BACKEND: JVM +// IGNORE_BACKEND_FIR: JVM_IR +// SAM_CONVERSIONS: CLASS +// ^ test checks reflection for synthetic classes +// FILE: J.java + +import java.util.Arrays; + +interface S, E extends C> { + void accept(A a, B b, C c, D d, E e); +} + +class J { + public static String foo(S, Integer> s) { + return Arrays.toString(s.getClass().getGenericInterfaces()); + } +} + +// FILE: 1.kt + +fun box(): String { + val supertypes = J.foo { a, b, c, d, e -> } + return if (supertypes == "[interface S]") "OK" else "Fail: $supertypes" +} diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface_ir.txt index 810a0867f21..b36c529224e 100644 --- a/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface_ir.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericFunInterface_ir.txt @@ -5,7 +5,7 @@ public interface<Ljava/lang/Object;> Sam { } @kotlin.Metadata -synthetic final class;Lkotlin/jvm/internal/FunctionAdapter;> TKt$genericSam$1 { +synthetic final class TKt$genericSam$1 { // source: 't.kt' public final @org.jetbrains.annotations.NotNull <()Lkotlin/Function<*>;> method getFunctionDelegate(): kotlin.Function public final <()TT;> method get(): java.lang.Object diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface_ir.txt index 74131c30203..1b1bc1e9dce 100644 --- a/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface_ir.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefGenericSamInterface_ir.txt @@ -1,5 +1,5 @@ @kotlin.Metadata -synthetic final class;> TKt$genericSam$1 { +synthetic final class TKt$genericSam$1 { // source: 't.kt' public final <()TT;> method get(): java.lang.Object static method (): void diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface_ir.txt index 5fc30d13306..765b8e61531 100644 --- a/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface_ir.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedFunInterface_ir.txt @@ -5,7 +5,7 @@ public interface<Ljava/lang/Object;> Sam { } @kotlin.Metadata -synthetic final class;Lkotlin/jvm/internal/FunctionAdapter;> TKt$specializedSam$1 { +synthetic final class TKt$specializedSam$1 { // source: 't.kt' public final @org.jetbrains.annotations.NotNull <()Lkotlin/Function<*>;> method getFunctionDelegate(): kotlin.Function static method (): void diff --git a/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface_ir.txt index b8aa2e40aec..ab12f67d6e5 100644 --- a/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface_ir.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/callableRefSpecializedSamInterface_ir.txt @@ -1,5 +1,5 @@ @kotlin.Metadata -synthetic final class;> TKt$specializedSam$1 { +synthetic final class TKt$specializedSam$1 { // source: 't.kt' static method (): void method (): void diff --git a/compiler/testData/codegen/bytecodeListing/sam/kt16650.txt b/compiler/testData/codegen/bytecodeListing/sam/kt16650.txt index 9a38d4261c5..8e0961d77c9 100644 --- a/compiler/testData/codegen/bytecodeListing/sam/kt16650.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/kt16650.txt @@ -1,5 +1,5 @@ @kotlin.Metadata -final class<Ljava/lang/Object;LKeySelector;> TKt$main$1 { +final class<Ljava/lang/Object;LKeySelector;> TKt$main$1 { // source: 't.kt' static method (): void method (): void @@ -11,7 +11,7 @@ final class<Ljava/lang/Object;LKeyS } @kotlin.Metadata -final class<Ljava/lang/Object;LKeySelector;> TKt$main$2 { +final class<Ljava/lang/Object;LKeySelector;> TKt$main$2 { // source: 't.kt' static method (): void method (): void diff --git a/compiler/testData/codegen/bytecodeListing/sam/kt16650_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/kt16650_ir.txt index 50b30869177..5126fc04ca2 100644 --- a/compiler/testData/codegen/bytecodeListing/sam/kt16650_ir.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/kt16650_ir.txt @@ -1,5 +1,5 @@ @kotlin.Metadata -final class<Ljava/lang/Object;LKeySelector;> TKt$main$1 { +final class<Ljava/lang/Object;LKeySelector;> TKt$main$1 { // source: 't.kt' static method (): void method (): void @@ -11,7 +11,7 @@ final class<Ljava/lang/Object;LKeyS } @kotlin.Metadata -final class<Ljava/lang/Object;LKeySelector;> TKt$main$2 { +final class<Ljava/lang/Object;LKeySelector;> TKt$main$2 { // source: 't.kt' static method (): void method (): void diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.txt index 7be23801bfd..be364dd5f6b 100644 --- a/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface.txt @@ -5,7 +5,7 @@ public interface<Ljava/lang/Object;> Sam { } @kotlin.Metadata -final class<Ljava/lang/Object;LSam;> TKt$genericSamGet$1 { +final class<Ljava/lang/Object;LSam;> TKt$genericSamGet$1 { // source: 't.kt' public final <()TT;> method get(): java.lang.Object method (p0: kotlin.jvm.functions.Function0): void diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface_ir.txt index 58ebc83375c..8f63b3d4373 100644 --- a/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface_ir.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericFunInterface_ir.txt @@ -5,7 +5,7 @@ public interface<Ljava/lang/Object;> Sam { } @kotlin.Metadata -final class<Ljava/lang/Object;LSam;> TKt$genericSamGet$1 { +final class<Ljava/lang/Object;LSam;> TKt$genericSamGet$1 { // source: 't.kt' public final <()TT;> method get(): java.lang.Object <(Lkotlin/jvm/functions/Function0<+TT;>;)V> method (p0: kotlin.jvm.functions.Function0): void diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.txt index 76f84e30b1c..62cbf730418 100644 --- a/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface.txt @@ -1,5 +1,5 @@ @kotlin.Metadata -final class<Ljava/lang/Object;LSam;> TKt$genericSam$1 { +final class<Ljava/lang/Object;LSam;> TKt$genericSam$1 { // source: 't.kt' public final <()TT;> method get(): java.lang.Object method (p0: kotlin.jvm.functions.Function0): void @@ -9,7 +9,7 @@ final class<Ljava/lang/Object;LSam;> TKt$genericSam$ } @kotlin.Metadata -final class<Ljava/lang/Object;LSam;> TKt$genericSamGet$1 { +final class<Ljava/lang/Object;LSam;> TKt$genericSamGet$1 { // source: 't.kt' public final <()TT;> method get(): java.lang.Object method (p0: kotlin.jvm.functions.Function0): void diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface_ir.txt index 023cc600dfa..eecd60944bf 100644 --- a/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface_ir.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaGenericSamInterface_ir.txt @@ -1,5 +1,5 @@ @kotlin.Metadata -final class<Ljava/lang/Object;LSam;> TKt$genericSam$1 { +final class<Ljava/lang/Object;LSam;> TKt$genericSam$1 { // source: 't.kt' public final <()TT;> method get(): java.lang.Object <(Lkotlin/jvm/functions/Function0<+TT;>;)V> method (p0: kotlin.jvm.functions.Function0): void @@ -9,7 +9,7 @@ final class<Ljava/lang/Object;LSam;> TKt$genericSam$ } @kotlin.Metadata -final class<Ljava/lang/Object;LSam;> TKt$genericSamGet$1 { +final class<Ljava/lang/Object;LSam;> TKt$genericSamGet$1 { // source: 't.kt' public final <()TT;> method get(): java.lang.Object <(Lkotlin/jvm/functions/Function0<+TT;>;)V> method (p0: kotlin.jvm.functions.Function0): void diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.txt index f2ab0e8776b..17c6d65bf22 100644 --- a/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface.txt @@ -5,7 +5,7 @@ public interface<Ljava/lang/Object;> Sam { } @kotlin.Metadata -final class<Ljava/lang/Object;LSam;> TKt$specializedSam$1 { +final class<Ljava/lang/Object;LSam;> TKt$specializedSam$1 { // source: 't.kt' method (p0: kotlin.jvm.functions.Function0): void public synthetic bridge method get(): java.lang.Object diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface_ir.txt index 8020d43de86..823c65a8645 100644 --- a/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface_ir.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedFunInterface_ir.txt @@ -5,7 +5,7 @@ public interface<Ljava/lang/Object;> Sam { } @kotlin.Metadata -final class<Ljava/lang/Object;LSam;> TKt$specializedSam$1 { +final class<Ljava/lang/Object;LSam;> TKt$specializedSam$1 { // source: 't.kt' <(Lkotlin/jvm/functions/Function0;)V> method (p0: kotlin.jvm.functions.Function0): void public synthetic bridge method get(): java.lang.Object diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.txt index f5cdf682a05..7f470d7752f 100644 --- a/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface.txt @@ -1,5 +1,5 @@ @kotlin.Metadata -final class<Ljava/lang/Object;LSam;> TKt$specializedSam$1 { +final class<Ljava/lang/Object;LSam;> TKt$specializedSam$1 { // source: 't.kt' method (p0: kotlin.jvm.functions.Function0): void public synthetic bridge method get(): java.lang.Object diff --git a/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface_ir.txt b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface_ir.txt index 9333ea1d30f..7c3aa366fd9 100644 --- a/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface_ir.txt +++ b/compiler/testData/codegen/bytecodeListing/sam/lambdaSpecializedSamInterface_ir.txt @@ -1,5 +1,5 @@ @kotlin.Metadata -final class<Ljava/lang/Object;LSam;> TKt$specializedSam$1 { +final class<Ljava/lang/Object;LSam;> TKt$specializedSam$1 { // source: 't.kt' <(Lkotlin/jvm/functions/Function0;)V> method (p0: kotlin.jvm.functions.Function0): void public synthetic bridge method get(): java.lang.Object diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index f995651f1b0..edbbe2b3cc7 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -38060,6 +38060,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/sam/samConversionToJavaWildcard.kt"); } + @Test + @TestMetadata("samInterfaceTypeParameterErasure.kt") + public void testSamInterfaceTypeParameterErasure() throws Exception { + runTest("compiler/testData/codegen/box/sam/samInterfaceTypeParameterErasure.kt"); + } + @Test @TestMetadata("smartCastSamConversion.kt") public void testSmartCastSamConversion() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 937981e4292..14aeea519b4 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -38084,6 +38084,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/sam/samConversionToJavaWildcard.kt"); } + @Test + @TestMetadata("samInterfaceTypeParameterErasure.kt") + public void testSamInterfaceTypeParameterErasure() throws Exception { + runTest("compiler/testData/codegen/box/sam/samInterfaceTypeParameterErasure.kt"); + } + @Test @TestMetadata("smartCastSamConversion.kt") public void testSmartCastSamConversion() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index f2338b03088..bfee0747e1c 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -30372,6 +30372,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/sam/samConversionToJavaWildcard.kt"); } + @TestMetadata("samInterfaceTypeParameterErasure.kt") + public void testSamInterfaceTypeParameterErasure() throws Exception { + runTest("compiler/testData/codegen/box/sam/samInterfaceTypeParameterErasure.kt"); + } + @TestMetadata("smartCastSamConversion.kt") public void testSmartCastSamConversion() throws Exception { runTest("compiler/testData/codegen/box/sam/smartCastSamConversion.kt");