From 9f4ef7fb6af5a9180e7b859ff43102953f2fd222 Mon Sep 17 00:00:00 2001 From: Alex Tkachman Date: Sat, 11 Feb 2012 13:04:26 +0200 Subject: [PATCH] KT-1186 test added --- .../testData/codegen/regressions/kt1186.kt | 28 +++++++++++++++++++ .../jetbrains/jet/codegen/ObjectGenTest.java | 4 +++ 2 files changed, 32 insertions(+) create mode 100644 compiler/testData/codegen/regressions/kt1186.kt diff --git a/compiler/testData/codegen/regressions/kt1186.kt b/compiler/testData/codegen/regressions/kt1186.kt new file mode 100644 index 00000000000..ddd42d63f12 --- /dev/null +++ b/compiler/testData/codegen/regressions/kt1186.kt @@ -0,0 +1,28 @@ +enum class Color(val rgb : Int) { + RED : Color(0xFF0000) + GREEN : Color(0x00FF00) + BLUE : Color(0x0000FF) +} + +enum class Direction { + NORTH + SOUTH + WEST + EAST +} + +fun bar(c: Color) = when (c) { + Color.RED -> 1 + Color.GREEN -> 2 + Color.BLUE -> 3 +} + +fun foo(d: Direction) = when(d) { + Direction.NORTH -> 1 + Direction.SOUTH -> 2 + Direction.WEST -> 3 + Direction.EAST -> 4 +} + +fun box() : String = + if (foo(Direction.EAST) == 4 && bar(Color.GREEN) == 2) "OK" else "fail" \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/codegen/ObjectGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ObjectGenTest.java index 9f24aef47ec..44f02c590fc 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/ObjectGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/ObjectGenTest.java @@ -42,4 +42,8 @@ public class ObjectGenTest extends CodegenTestCase { public void testKt694() throws Exception { blackBoxFile("regressions/kt694.kt"); } + + public void testKt1186() throws Exception { + blackBoxFile("regressions/kt1186.kt"); + } }