diff --git a/compiler/testData/codegen/box/coroutines/kt31784.kt b/compiler/testData/codegen/box/coroutines/kt31784.kt new file mode 100644 index 00000000000..670609da260 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/kt31784.kt @@ -0,0 +1,34 @@ +// !LANGUAGE: +NewInference +// WITH_RUNTIME + +@file:UseExperimental(ExperimentalTypeInference::class) + +package test + +import kotlin.experimental.ExperimentalTypeInference + +interface Builder { + fun filter(filter: (T) -> Boolean) +} + +fun build(@BuilderInference block: Builder.() -> Unit): T { + val o = object : Builder { + override fun filter(filter: (T) -> Boolean) { + + } + } + + o.block() + + return 42 as T +} + +fun box(): String { + val r = build { + filter { + it > 10 + } + } + + return if (r == 42) "OK" else "Fail: $r" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/fullJdk/kt31757.kt b/compiler/testData/codegen/box/fullJdk/kt31757.kt new file mode 100644 index 00000000000..d25e8cade55 --- /dev/null +++ b/compiler/testData/codegen/box/fullJdk/kt31757.kt @@ -0,0 +1,19 @@ +// !LANGUAGE: +NewInference +// TARGET_BACKEND: JVM +// FULL_JDK + +package test + +import java.util.function.* + +interface Interface1 : () -> T, Supplier { + override fun invoke() = get() +} + +class Impl : Interface1 { + override fun get(): String = "OK" +} + +fun box(): String { + return Impl()() +} \ 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 7d5fdf4d66d..cf5791bc8b8 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -6054,6 +6054,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/kt30858.kt"); } + @TestMetadata("kt31784.kt") + public void testKt31784() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt31784.kt"); + } + @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines.experimental"); @@ -10944,6 +10949,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/fullJdk/intCountDownLatchExtension.kt"); } + @TestMetadata("kt31757.kt") + public void testKt31757() throws Exception { + runTest("compiler/testData/codegen/box/fullJdk/kt31757.kt"); + } + @TestMetadata("kt434.kt") public void testKt434() throws Exception { runTest("compiler/testData/codegen/box/fullJdk/kt434.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 90beaf151fd..91934f15490 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -6054,6 +6054,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/kt30858.kt"); } + @TestMetadata("kt31784.kt") + public void testKt31784() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt31784.kt"); + } + @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines.experimental"); @@ -10944,6 +10949,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/fullJdk/intCountDownLatchExtension.kt"); } + @TestMetadata("kt31757.kt") + public void testKt31757() throws Exception { + runTest("compiler/testData/codegen/box/fullJdk/kt31757.kt"); + } + @TestMetadata("kt434.kt") public void testKt434() throws Exception { runTest("compiler/testData/codegen/box/fullJdk/kt434.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index d12a76351ef..0a21ae7e092 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -6054,6 +6054,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/kt30858.kt"); } + @TestMetadata("kt31784.kt") + public void testKt31784() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt31784.kt"); + } + @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines.experimental"); @@ -10944,6 +10949,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/fullJdk/intCountDownLatchExtension.kt"); } + @TestMetadata("kt31757.kt") + public void testKt31757() throws Exception { + runTest("compiler/testData/codegen/box/fullJdk/kt31757.kt"); + } + @TestMetadata("kt434.kt") public void testKt434() throws Exception { runTest("compiler/testData/codegen/box/fullJdk/kt434.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 421a51b52d5..97ead3141bc 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -4949,6 +4949,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/kt30858.kt"); } + @TestMetadata("kt31784.kt") + public void testKt31784() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt31784.kt"); + } + @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop_1_3() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines"); 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 20a298d42e5..340411a9486 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 @@ -5174,6 +5174,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/kt30858.kt"); } + @TestMetadata("kt31784.kt") + public void testKt31784() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/kt31784.kt"); + } + @TestMetadata("lastExpressionIsLoop.kt") public void testLastExpressionIsLoop_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt", "kotlin.coroutines.experimental");