diff --git a/compiler/testData/codegen/boxInline/reified/kt6988.1.kt b/compiler/testData/codegen/boxInline/reified/kt6988.1.kt new file mode 100644 index 00000000000..a83523e9ba0 --- /dev/null +++ b/compiler/testData/codegen/boxInline/reified/kt6988.1.kt @@ -0,0 +1,10 @@ +import test.* + +public class A() + +fun box(): String { + val s = "yo".inlineMeIfYouCan()().call() + if (s !is A) return "fail" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/reified/kt6988.2.kt b/compiler/testData/codegen/boxInline/reified/kt6988.2.kt new file mode 100644 index 00000000000..a4658c5e741 --- /dev/null +++ b/compiler/testData/codegen/boxInline/reified/kt6988.2.kt @@ -0,0 +1,11 @@ +package test + +interface Call { + fun call(): T +} + +public inline fun Any.inlineMeIfYouCan() : () -> Call = { + object : Call { + override fun call() = T::class.java.newInstance() + } +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/reified/kt6988_2.1.kt b/compiler/testData/codegen/boxInline/reified/kt6988_2.1.kt new file mode 100644 index 00000000000..60f80a52045 --- /dev/null +++ b/compiler/testData/codegen/boxInline/reified/kt6988_2.1.kt @@ -0,0 +1,6 @@ +import test.* + +fun box(): String { + "yo".inlineMeIfYouCan()().run() + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxInline/reified/kt6988_2.2.kt b/compiler/testData/codegen/boxInline/reified/kt6988_2.2.kt new file mode 100644 index 00000000000..d0a4c8af5c1 --- /dev/null +++ b/compiler/testData/codegen/boxInline/reified/kt6988_2.2.kt @@ -0,0 +1,10 @@ +package test + + +public inline fun Any.inlineMeIfYouCan() : () -> Runnable = { + object : Runnable { + override fun run() { + javaClass().newInstance() + } + } +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxInlineCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxInlineCodegenTestGenerated.java index b373f23792c..cf8c010ab71 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxInlineCodegenTestGenerated.java @@ -1072,6 +1072,18 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo doTestMultiFileWithInlineCheck(fileName); } + @TestMetadata("kt6988.1.kt") + public void testKt6988() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/reified/kt6988.1.kt"); + doTestMultiFileWithInlineCheck(fileName); + } + + @TestMetadata("kt6988_2.1.kt") + public void testKt6988_2() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/reified/kt6988_2.1.kt"); + doTestMultiFileWithInlineCheck(fileName); + } + @TestMetadata("packages.1.kt") public void testPackages() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/reified/packages.1.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstInlineKotlinTestGenerated.java index f51b3b688ee..1c7d030b0d5 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstInlineKotlinTestGenerated.java @@ -1072,6 +1072,18 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi doBoxTestWithInlineCheck(fileName); } + @TestMetadata("kt6988.1.kt") + public void testKt6988() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/reified/kt6988.1.kt"); + doBoxTestWithInlineCheck(fileName); + } + + @TestMetadata("kt6988_2.1.kt") + public void testKt6988_2() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/reified/kt6988_2.1.kt"); + doBoxTestWithInlineCheck(fileName); + } + @TestMetadata("packages.1.kt") public void testPackages() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/reified/packages.1.kt");