diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index da4258d6769..3050b4b6845 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -13,12 +13,9 @@
-
+
-
-
-
-
+
@@ -118,7 +115,7 @@
-
+
@@ -191,7 +188,7 @@
-
+
@@ -201,37 +198,46 @@
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
@@ -240,52 +246,43 @@
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
@@ -316,8 +313,6 @@
@@ -564,6 +561,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -606,35 +671,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -763,6 +800,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -949,11 +1014,11 @@
-
-
-
-
-
+
+
+
+
+
localhost
@@ -1041,7 +1106,7 @@
-
+
@@ -1089,7 +1154,7 @@
-
+
@@ -1102,7 +1167,6 @@
-
@@ -1127,6 +1191,7 @@
+
@@ -1136,20 +1201,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1157,51 +1208,30 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
+
@@ -1213,12 +1243,17 @@
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -1229,13 +1264,6 @@
-
-
-
-
-
-
-
@@ -1243,9 +1271,44 @@
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/translator/test/org/jetbrains/k2js/test/PatternMatchingTest.java b/translator/test/org/jetbrains/k2js/test/PatternMatchingTest.java
index 64d3dfba607..0d208559776 100644
--- a/translator/test/org/jetbrains/k2js/test/PatternMatchingTest.java
+++ b/translator/test/org/jetbrains/k2js/test/PatternMatchingTest.java
@@ -45,6 +45,11 @@ public final class PatternMatchingTest extends TranslationTest {
// testFooBoxIsTrue("whenValueOrType.kt");
// }
+ @Test
+ public void whenWithIf() throws Exception {
+ testFooBoxIsTrue("whenWithIf.kt");
+ }
+
@Test
public void multipleCases() throws Exception {
testFunctionOutput("multipleCases.kt", "foo", "box", 2.0);
diff --git a/translator/testFiles/patternMatching/cases/whenWithIf.kt b/translator/testFiles/patternMatching/cases/whenWithIf.kt
new file mode 100644
index 00000000000..f7df3292b4c
--- /dev/null
+++ b/translator/testFiles/patternMatching/cases/whenWithIf.kt
@@ -0,0 +1,19 @@
+package foo
+
+fun box() : Boolean {
+
+ var c = when(3) {
+ 3 -> 1
+ 2 -> 100
+ else -> 100
+ } + when (2) {
+ 1 -> 100
+ else -> 1
+ } + when (0) {
+ 1 -> if (true) 100 else 100
+ 0 -> if (false) {100} else {1}
+ else -> 100
+ }
+
+ return c == 3
+}
\ No newline at end of file