From 7b2de2de5ec82f7cff386a8b402c41d304009ba3 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Fri, 16 Mar 2018 21:56:24 +0300 Subject: [PATCH] Add regression test for KT-20744 #KT-20744: Obsolete --- .../featureIntersection/delegate.kt | 27 +++++++++++++++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 6 +++++ .../codegen/BlackBoxCodegenTestGenerated.java | 6 +++++ .../LightAnalysisModeTestGenerated.java | 6 +++++ .../semantics/JsCodegenBoxTestGenerated.java | 6 +++++ 5 files changed, 51 insertions(+) create mode 100644 compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt new file mode 100644 index 00000000000..eed8775a6eb --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt @@ -0,0 +1,27 @@ +// WITH_RUNTIME +// WITH_COROUTINES + +import helpers.* +import kotlin.coroutines.experimental.* +import kotlin.properties.Delegates + +class Pipe { + var value = 0 + suspend fun send(value: Int) { + this.value = value + } +} + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(EmptyContinuation) +} + +val pipe = Pipe() + +var mode by Delegates.observable(0) {_, _, value -> builder { pipe.send(value) }} + +fun box() : String { + mode = 42 + if (pipe.value != 42) return "FAIL" + return "OK" +} diff --git a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index fc57d1e55da..7dc638fc227 100644 --- a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -6283,6 +6283,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } + @TestMetadata("delegate.kt") + public void testDelegate() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt"); + doTest(fileName); + } + @TestMetadata("destructuringInLambdas.kt") public void testDestructuringInLambdas() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 983f1117751..240ad2b8b46 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -6283,6 +6283,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } + @TestMetadata("delegate.kt") + public void testDelegate() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt"); + doTest(fileName); + } + @TestMetadata("destructuringInLambdas.kt") public void testDestructuringInLambdas() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 29a47233627..fe5186250ea 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -6283,6 +6283,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes doTest(fileName); } + @TestMetadata("delegate.kt") + public void testDelegate() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt"); + doTest(fileName); + } + @TestMetadata("destructuringInLambdas.kt") public void testDestructuringInLambdas() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt"); 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 37405e168b1..7c07af00e7f 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 @@ -7602,6 +7602,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { doTest(fileName); } + @TestMetadata("delegate.kt") + public void testDelegate() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/delegate.kt"); + doTest(fileName); + } + @TestMetadata("destructuringInLambdas.kt") public void testDestructuringInLambdas() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/featureIntersection/destructuringInLambdas.kt");