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 397bc16b02a..334731fb4da 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 @@ -20021,6 +20021,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/invokedynamic/sam/genericFunInterfaceWithPrimitive.kt"); } + @Test + @TestMetadata("intReturnTypeAsNumber.kt") + public void testIntReturnTypeAsNumber() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/intReturnTypeAsNumber.kt"); + } + @Test @TestMetadata("nullabilityAssertions.kt") public void testNullabilityAssertions() throws Exception { @@ -20220,6 +20226,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/innerConstructorRef.kt"); } + @Test + @TestMetadata("intReturnTypeAsNumber.kt") + public void testIntReturnTypeAsNumber() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/intReturnTypeAsNumber.kt"); + } + @Test @TestMetadata("localFunction1.kt") public void testLocalFunction1() throws Exception { @@ -20244,11 +20256,41 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nonTrivialReceiver.kt"); } + @Test + @TestMetadata("nothingReturnTypeAsObject.kt") + public void testNothingReturnTypeAsObject() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsObject.kt"); + } + + @Test + @TestMetadata("nothingReturnTypeAsString.kt") + public void testNothingReturnTypeAsString() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsString.kt"); + } + + @Test + @TestMetadata("nullableNothingReturnTypeAsObject.kt") + public void testNullableNothingReturnTypeAsObject() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsObject.kt"); + } + + @Test + @TestMetadata("nullableNothingReturnTypeAsString.kt") + public void testNullableNothingReturnTypeAsString() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsString.kt"); + } + @Test @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/simple.kt"); } + + @Test + @TestMetadata("voidReturnTypeAsObject.kt") + public void testVoidReturnTypeAsObject() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/voidReturnTypeAsObject.kt"); + } } @Nested @@ -20354,6 +20396,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/covariantOverrideWithNNothing.kt"); } + @Test + @TestMetadata("genericWithInProjection.kt") + public void testGenericWithInProjection() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithInProjection.kt"); + } + + @Test + @TestMetadata("genericWithStarProjection.kt") + public void testGenericWithStarProjection() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithStarProjection.kt"); + } + @Test @TestMetadata("inheritedWithChar.kt") public void testInheritedWithChar() throws Exception { @@ -20414,6 +20468,30 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixPrimitiveAndBoxed.kt"); } + @Test + @TestMetadata("nothingReturnTypeAsGeneric.kt") + public void testNothingReturnTypeAsGeneric() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsGeneric.kt"); + } + + @Test + @TestMetadata("nothingReturnTypeAsString.kt") + public void testNothingReturnTypeAsString() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsString.kt"); + } + + @Test + @TestMetadata("specializedWithChar.kt") + public void testSpecializedWithChar() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithChar.kt"); + } + + @Test + @TestMetadata("specializedWithCharClass.kt") + public void testSpecializedWithCharClass() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithCharClass.kt"); + } + @Test @TestMetadata("voidReturnTypeAsGeneric.kt") public void testVoidReturnTypeAsGeneric() throws Exception { 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 f23c451fc17..cf3433b9e14 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 @@ -241,6 +241,8 @@ internal class LambdaMetafactoryArgumentsBuilder( } if (!checkTypeCompliesWithConstraint(implFun.returnType, constraints.returnType)) return false + if (implFun.returnType.isUnit() && !fakeInstanceMethod.returnType.isUnit()) + return false return true } @@ -278,7 +280,9 @@ internal class LambdaMetafactoryArgumentsBuilder( implParameter.type = implParameter.type.makeNullable() } } - if (constraints.returnType.requiresImplLambdaBoxing()) { + if (constraints.returnType.requiresImplLambdaBoxing() || + implFun.returnType.isUnit() && !fakeInstanceMethod.returnType.isUnit() + ) { implFun.returnType = implFun.returnType.makeNullable() } } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/intReturnTypeAsNumber.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/intReturnTypeAsNumber.kt new file mode 100644 index 00000000000..12034f04bdc --- /dev/null +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/intReturnTypeAsNumber.kt @@ -0,0 +1,16 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// SAM_CONVERSIONS: INDY +// FILE: intReturnTypeAsNumber.kt + +fun box(): String { + val num = Sam { 42 } + if (num.get() != 42) + return "Failed" + return "OK" +} + +// FILE: Sam.java +public interface Sam { + Number get(); +} diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsObject.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsObject.kt new file mode 100644 index 00000000000..d57c0ceb449 --- /dev/null +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsObject.kt @@ -0,0 +1,25 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// SAM_CONVERSIONS: INDY +// FILE: nothingReturnTypeAsObject.kt + +fun interface IFoo { + fun foo(): T +} + +fun thr(s: String): Nothing = throw RuntimeException(s) + +fun box(): String { + try { + Sam(::thr).get("OK") + } catch (e: RuntimeException) { + return e.message!! + } + return "Failed" +} + + +// FILE: Sam.java +public interface Sam { + Object get(String s); +} diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsString.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsString.kt new file mode 100644 index 00000000000..0ced755167e --- /dev/null +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsString.kt @@ -0,0 +1,25 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// SAM_CONVERSIONS: INDY +// FILE: nothingReturnTypeAsString.kt + +fun interface IFoo { + fun foo(): T +} + +fun thr(s: String): Nothing = throw RuntimeException(s) + +fun box(): String { + try { + Sam(::thr).get("OK") + } catch (e: RuntimeException) { + return e.message!! + } + return "Failed" +} + + +// FILE: Sam.java +public interface Sam { + String get(String s); +} diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsObject.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsObject.kt new file mode 100644 index 00000000000..36fa4eb8c9c --- /dev/null +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsObject.kt @@ -0,0 +1,28 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// SAM_CONVERSIONS: INDY +// FILE: nullableNothingReturnTypeAsObject.kt + +fun interface IFoo { + fun foo(): T +} + +var t = "Failed" + +fun test(s: String): Nothing? { + t = s + return null +} + +fun box(): String { + val q = Sam(::test).get("OK") + if (q != null) + return "Failed: $q" + return t +} + + +// FILE: Sam.java +public interface Sam { + Object get(String s); +} diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsString.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsString.kt new file mode 100644 index 00000000000..f45b8ffeb3b --- /dev/null +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsString.kt @@ -0,0 +1,28 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// SAM_CONVERSIONS: INDY +// FILE: nullableNothingReturnTypeAsString.kt + +fun interface IFoo { + fun foo(): T +} + +var t = "Failed" + +fun test(s: String): Nothing? { + t = s + return null +} + +fun box(): String { + val q = Sam(::test).get("OK") + if (q != null) + return "Failed: $q" + return t +} + + +// FILE: Sam.java +public interface Sam { + String get(String s); +} diff --git a/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/voidReturnTypeAsObject.kt b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/voidReturnTypeAsObject.kt new file mode 100644 index 00000000000..550a82dd70c --- /dev/null +++ b/compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/voidReturnTypeAsObject.kt @@ -0,0 +1,20 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// SAM_CONVERSIONS: INDY +// FILE: voidReturnTypeAsObject.kt +var t = "Failed" + +fun ok(s: String) { t = s } + +fun box(): String { + val r = Sam(::ok).get("OK") + if (r != Unit) { + return "Failed: $r" + } + return t +} + +// FILE: Sam.java +public interface Sam { + Object get(String s); +} diff --git a/compiler/testData/codegen/box/invokedynamic/sam/intReturnTypeAsNumber.kt b/compiler/testData/codegen/box/invokedynamic/sam/intReturnTypeAsNumber.kt new file mode 100644 index 00000000000..215988d3e0c --- /dev/null +++ b/compiler/testData/codegen/box/invokedynamic/sam/intReturnTypeAsNumber.kt @@ -0,0 +1,14 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// SAM_CONVERSIONS: INDY + +fun interface INum { + fun get(): Number +} + +fun box(): String { + val num = INum { 42 } + if (num.get() != 42) + return "Failed" + return "OK" +} diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithInProjection.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithInProjection.kt new file mode 100644 index 00000000000..8ee40e71c35 --- /dev/null +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithInProjection.kt @@ -0,0 +1,18 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// SAM_CONVERSIONS: INDY + +fun interface Cmp { + fun compare(a: T, b: T): Int +} + +fun foo(comparator: Cmp, a: T, b: T) = comparator.compare(a, b) + +fun bar(x: Int, y: Int) = foo({ a, b -> a - b}, x, y) + +fun box(): String { + val t = bar(42, 117) + if (t != -75) + return "Failed: t=$t" + return "OK" +} diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithStarProjection.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithStarProjection.kt new file mode 100644 index 00000000000..84e5e2f6ccb --- /dev/null +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithStarProjection.kt @@ -0,0 +1,16 @@ +// TARGET_BACKEND: JVM +// IGNORE_BACKEND_FIR: JVM_IR +// JVM_TARGET: 1.8 +// SAM_CONVERSIONS: INDY +fun interface Cmp { + fun compare(a: T, b: T): Int +} + +fun cmp(c: Cmp<*>) = c + +fun box(): String { + val c = cmp { _, _ -> 0 } as Cmp + if (c.compare(1, 2) != 0) + return "Failed" + return "OK" +} diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithChar.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithChar.kt index aa997eb4743..1ad8a6c7630 100644 --- a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithChar.kt +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithChar.kt @@ -1,7 +1,6 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 // SAM_CONVERSIONS: INDY -// IGNORE_DEXING fun interface GenericToAny { fun invoke(x: T): Any @@ -12,4 +11,4 @@ fun interface GenericCharToAny : GenericToAny fun withK(fn: GenericCharToAny) = fn.invoke('K').toString() fun box(): String = - withK { "O" + it } \ No newline at end of file + withK { "O" + it } diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsGeneric.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsGeneric.kt new file mode 100644 index 00000000000..c69addcf1c4 --- /dev/null +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsGeneric.kt @@ -0,0 +1,18 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// SAM_CONVERSIONS: INDY + +fun interface IFoo { + fun foo(): T +} + +fun foo(iFoo: IFoo) = iFoo.foo() + +fun box(): String { + try { + foo { throw RuntimeException("OK") } + } catch (e: RuntimeException) { + return e.message!! + } + return "Failed" +} diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsString.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsString.kt new file mode 100644 index 00000000000..2c6280d91fc --- /dev/null +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsString.kt @@ -0,0 +1,18 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// SAM_CONVERSIONS: INDY + +fun interface IFoo { + fun foo(): String +} + +fun foo(iFoo: IFoo) = iFoo.foo() + +fun box(): String { + try { + foo { throw RuntimeException("OK") } + } catch (e: RuntimeException) { + return e.message!! + } + return "Failed" +} diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithChar.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithChar.kt new file mode 100644 index 00000000000..3084b7761d5 --- /dev/null +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithChar.kt @@ -0,0 +1,16 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// SAM_CONVERSIONS: INDY + +fun interface GenericToAny { + fun invoke(Inner: T): Any +} + +fun foo2(t: T, g: GenericToAny): Any = g.invoke(t) + +fun box(): String { + foo2('.') { } + return "OK" +} + + diff --git a/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithCharClass.kt b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithCharClass.kt new file mode 100644 index 00000000000..7366e524789 --- /dev/null +++ b/compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithCharClass.kt @@ -0,0 +1,14 @@ +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// SAM_CONVERSIONS: CLASS + +fun interface GenericToAny { + fun invoke(Inner: T): Any +} + +fun foo2(t: T, g: GenericToAny): Any = g.invoke(t) + +fun box(): String { + foo2('.') { } + return "OK" +} 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 373a84800e0..c33a85383c9 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 @@ -20021,6 +20021,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/invokedynamic/sam/genericFunInterfaceWithPrimitive.kt"); } + @Test + @TestMetadata("intReturnTypeAsNumber.kt") + public void testIntReturnTypeAsNumber() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/intReturnTypeAsNumber.kt"); + } + @Test @TestMetadata("nullabilityAssertions.kt") public void testNullabilityAssertions() throws Exception { @@ -20220,6 +20226,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/innerConstructorRef.kt"); } + @Test + @TestMetadata("intReturnTypeAsNumber.kt") + public void testIntReturnTypeAsNumber() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/intReturnTypeAsNumber.kt"); + } + @Test @TestMetadata("localFunction1.kt") public void testLocalFunction1() throws Exception { @@ -20244,11 +20256,41 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nonTrivialReceiver.kt"); } + @Test + @TestMetadata("nothingReturnTypeAsObject.kt") + public void testNothingReturnTypeAsObject() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsObject.kt"); + } + + @Test + @TestMetadata("nothingReturnTypeAsString.kt") + public void testNothingReturnTypeAsString() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsString.kt"); + } + + @Test + @TestMetadata("nullableNothingReturnTypeAsObject.kt") + public void testNullableNothingReturnTypeAsObject() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsObject.kt"); + } + + @Test + @TestMetadata("nullableNothingReturnTypeAsString.kt") + public void testNullableNothingReturnTypeAsString() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsString.kt"); + } + @Test @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/simple.kt"); } + + @Test + @TestMetadata("voidReturnTypeAsObject.kt") + public void testVoidReturnTypeAsObject() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/voidReturnTypeAsObject.kt"); + } } @Nested @@ -20354,6 +20396,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/covariantOverrideWithNNothing.kt"); } + @Test + @TestMetadata("genericWithInProjection.kt") + public void testGenericWithInProjection() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithInProjection.kt"); + } + + @Test + @TestMetadata("genericWithStarProjection.kt") + public void testGenericWithStarProjection() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithStarProjection.kt"); + } + @Test @TestMetadata("inheritedWithChar.kt") public void testInheritedWithChar() throws Exception { @@ -20414,6 +20468,30 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixPrimitiveAndBoxed.kt"); } + @Test + @TestMetadata("nothingReturnTypeAsGeneric.kt") + public void testNothingReturnTypeAsGeneric() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsGeneric.kt"); + } + + @Test + @TestMetadata("nothingReturnTypeAsString.kt") + public void testNothingReturnTypeAsString() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsString.kt"); + } + + @Test + @TestMetadata("specializedWithChar.kt") + public void testSpecializedWithChar() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithChar.kt"); + } + + @Test + @TestMetadata("specializedWithCharClass.kt") + public void testSpecializedWithCharClass() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithCharClass.kt"); + } + @Test @TestMetadata("voidReturnTypeAsGeneric.kt") public void testVoidReturnTypeAsGeneric() 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 c873259ea07..5868bc5ebc8 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 @@ -20021,6 +20021,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/invokedynamic/sam/genericFunInterfaceWithPrimitive.kt"); } + @Test + @TestMetadata("intReturnTypeAsNumber.kt") + public void testIntReturnTypeAsNumber() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/intReturnTypeAsNumber.kt"); + } + @Test @TestMetadata("nullabilityAssertions.kt") public void testNullabilityAssertions() throws Exception { @@ -20220,6 +20226,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/innerConstructorRef.kt"); } + @Test + @TestMetadata("intReturnTypeAsNumber.kt") + public void testIntReturnTypeAsNumber() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/intReturnTypeAsNumber.kt"); + } + @Test @TestMetadata("localFunction1.kt") public void testLocalFunction1() throws Exception { @@ -20244,11 +20256,41 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nonTrivialReceiver.kt"); } + @Test + @TestMetadata("nothingReturnTypeAsObject.kt") + public void testNothingReturnTypeAsObject() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsObject.kt"); + } + + @Test + @TestMetadata("nothingReturnTypeAsString.kt") + public void testNothingReturnTypeAsString() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsString.kt"); + } + + @Test + @TestMetadata("nullableNothingReturnTypeAsObject.kt") + public void testNullableNothingReturnTypeAsObject() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsObject.kt"); + } + + @Test + @TestMetadata("nullableNothingReturnTypeAsString.kt") + public void testNullableNothingReturnTypeAsString() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsString.kt"); + } + @Test @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/simple.kt"); } + + @Test + @TestMetadata("voidReturnTypeAsObject.kt") + public void testVoidReturnTypeAsObject() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/voidReturnTypeAsObject.kt"); + } } @Nested @@ -20354,6 +20396,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/covariantOverrideWithNNothing.kt"); } + @Test + @TestMetadata("genericWithInProjection.kt") + public void testGenericWithInProjection() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithInProjection.kt"); + } + + @Test + @TestMetadata("genericWithStarProjection.kt") + public void testGenericWithStarProjection() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithStarProjection.kt"); + } + @Test @TestMetadata("inheritedWithChar.kt") public void testInheritedWithChar() throws Exception { @@ -20414,6 +20468,30 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixPrimitiveAndBoxed.kt"); } + @Test + @TestMetadata("nothingReturnTypeAsGeneric.kt") + public void testNothingReturnTypeAsGeneric() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsGeneric.kt"); + } + + @Test + @TestMetadata("nothingReturnTypeAsString.kt") + public void testNothingReturnTypeAsString() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsString.kt"); + } + + @Test + @TestMetadata("specializedWithChar.kt") + public void testSpecializedWithChar() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithChar.kt"); + } + + @Test + @TestMetadata("specializedWithCharClass.kt") + public void testSpecializedWithCharClass() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithCharClass.kt"); + } + @Test @TestMetadata("voidReturnTypeAsGeneric.kt") public void testVoidReturnTypeAsGeneric() 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 91c7aec724b..cdaebd624d9 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -16791,6 +16791,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/invokedynamic/sam/genericFunInterfaceWithPrimitive.kt"); } + @TestMetadata("intReturnTypeAsNumber.kt") + public void testIntReturnTypeAsNumber() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/intReturnTypeAsNumber.kt"); + } + @TestMetadata("nullabilityAssertions.kt") public void testNullabilityAssertions() throws Exception { runTest("compiler/testData/codegen/box/invokedynamic/sam/nullabilityAssertions.kt"); @@ -16961,6 +16966,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/innerConstructorRef.kt"); } + @TestMetadata("intReturnTypeAsNumber.kt") + public void testIntReturnTypeAsNumber() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/intReturnTypeAsNumber.kt"); + } + @TestMetadata("localFunction1.kt") public void testLocalFunction1() throws Exception { runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/localFunction1.kt"); @@ -16981,10 +16991,35 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nonTrivialReceiver.kt"); } + @TestMetadata("nothingReturnTypeAsObject.kt") + public void testNothingReturnTypeAsObject() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsObject.kt"); + } + + @TestMetadata("nothingReturnTypeAsString.kt") + public void testNothingReturnTypeAsString() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nothingReturnTypeAsString.kt"); + } + + @TestMetadata("nullableNothingReturnTypeAsObject.kt") + public void testNullableNothingReturnTypeAsObject() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsObject.kt"); + } + + @TestMetadata("nullableNothingReturnTypeAsString.kt") + public void testNullableNothingReturnTypeAsString() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/nullableNothingReturnTypeAsString.kt"); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/simple.kt"); } + + @TestMetadata("voidReturnTypeAsObject.kt") + public void testVoidReturnTypeAsObject() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/functionRefToJavaInterface/voidReturnTypeAsObject.kt"); + } } @TestMetadata("compiler/testData/codegen/box/invokedynamic/sam/inlineClassInSignature") @@ -17087,6 +17122,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/covariantOverrideWithNNothing.kt"); } + @TestMetadata("genericWithInProjection.kt") + public void testGenericWithInProjection() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithInProjection.kt"); + } + + @TestMetadata("genericWithStarProjection.kt") + public void testGenericWithStarProjection() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/genericWithStarProjection.kt"); + } + @TestMetadata("inheritedWithChar.kt") public void testInheritedWithChar() throws Exception { runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/inheritedWithChar.kt"); @@ -17132,6 +17177,26 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/mixGenericArrayAndArrayOfString.kt"); } + @TestMetadata("nothingReturnTypeAsGeneric.kt") + public void testNothingReturnTypeAsGeneric() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsGeneric.kt"); + } + + @TestMetadata("nothingReturnTypeAsString.kt") + public void testNothingReturnTypeAsString() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/nothingReturnTypeAsString.kt"); + } + + @TestMetadata("specializedWithChar.kt") + public void testSpecializedWithChar() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithChar.kt"); + } + + @TestMetadata("specializedWithCharClass.kt") + public void testSpecializedWithCharClass() throws Exception { + runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithCharClass.kt"); + } + @TestMetadata("voidReturnTypeAsGeneric.kt") public void testVoidReturnTypeAsGeneric() throws Exception { runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/voidReturnTypeAsGeneric.kt");