From 4d9661890a9bfbf46bf6d191eba16b7d1bdfde03 Mon Sep 17 00:00:00 2001 From: pyos Date: Tue, 30 Apr 2019 11:53:33 +0200 Subject: [PATCH] Test reification of type parameters into Array(size, init) (cherry picked from commit 6daa61ef5fb7894a6d104a254662a0e24e95ae0c) --- .../codegen/boxInline/reified/arrayConstructor.kt | 10 ++++++++++ .../codegen/BlackBoxInlineCodegenTestGenerated.java | 5 +++++ .../CompileKotlinAgainstInlineKotlinTestGenerated.java | 5 +++++ .../ir/IrBlackBoxInlineCodegenTestGenerated.java | 5 +++++ 4 files changed, 25 insertions(+) create mode 100644 compiler/testData/codegen/boxInline/reified/arrayConstructor.kt diff --git a/compiler/testData/codegen/boxInline/reified/arrayConstructor.kt b/compiler/testData/codegen/boxInline/reified/arrayConstructor.kt new file mode 100644 index 00000000000..0df030eafb6 --- /dev/null +++ b/compiler/testData/codegen/boxInline/reified/arrayConstructor.kt @@ -0,0 +1,10 @@ +// FILE: 1.kt +package test + +inline fun f(x : () -> T): Array = Array(1) { x() } + +// FILE: 2.kt + +import test.* + +fun box(): String = f { "OK" }[0] diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java index f5dc99002c2..8899c32ba40 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java @@ -2604,6 +2604,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/reified"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } + @TestMetadata("arrayConstructor.kt") + public void testArrayConstructor() throws Exception { + runTest("compiler/testData/codegen/boxInline/reified/arrayConstructor.kt"); + } + @TestMetadata("capturedLambda.kt") public void testCapturedLambda() throws Exception { runTest("compiler/testData/codegen/boxInline/reified/capturedLambda.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java index cab47d758a1..249eba66637 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java @@ -2604,6 +2604,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/reified"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } + @TestMetadata("arrayConstructor.kt") + public void testArrayConstructor() throws Exception { + runTest("compiler/testData/codegen/boxInline/reified/arrayConstructor.kt"); + } + @TestMetadata("capturedLambda.kt") public void testCapturedLambda() throws Exception { runTest("compiler/testData/codegen/boxInline/reified/capturedLambda.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java index 5ba382ab94f..5ef8f18f5b5 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java @@ -2604,6 +2604,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/reified"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true); } + @TestMetadata("arrayConstructor.kt") + public void testArrayConstructor() throws Exception { + runTest("compiler/testData/codegen/boxInline/reified/arrayConstructor.kt"); + } + @TestMetadata("capturedLambda.kt") public void testCapturedLambda() throws Exception { runTest("compiler/testData/codegen/boxInline/reified/capturedLambda.kt");