From 2e27fb80f306b506d935273cd554e89b34e9d100 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Wed, 23 Jan 2013 19:23:27 +0400 Subject: [PATCH] KT-3273 Return type coalesces to Tuple0 in when/if nested clauses #KT-3273 Fixed --- compiler/testData/codegen/regressions/kt3273.kt | 17 +++++++++++++++++ .../jet/codegen/ControlStructuresTest.java | 5 +++++ 2 files changed, 22 insertions(+) create mode 100644 compiler/testData/codegen/regressions/kt3273.kt diff --git a/compiler/testData/codegen/regressions/kt3273.kt b/compiler/testData/codegen/regressions/kt3273.kt new file mode 100644 index 00000000000..2e13e6370ae --- /dev/null +++ b/compiler/testData/codegen/regressions/kt3273.kt @@ -0,0 +1,17 @@ +public fun testCoalesce() { + val value: String = when { + true -> { + if (true) { + "foo" + } else { + "bar" + } + } + else -> "Hello world" + } +} + +fun box(): String { + testCoalesce() + return "OK" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/codegen/ControlStructuresTest.java b/compiler/tests/org/jetbrains/jet/codegen/ControlStructuresTest.java index bd3b57c0981..5730bde3a30 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/ControlStructuresTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/ControlStructuresTest.java @@ -486,4 +486,9 @@ public class ControlStructuresTest extends CodegenTestCase { createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); blackBoxFile("regressions/kt3203_2.kt"); } + + public void testKt3273() { + createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); + blackBoxFile("regressions/kt3273.kt"); + } }