diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a593d8e703a..20232350b50 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -14,12 +14,10 @@
-
+
+
-
-
-
-
+
@@ -289,15 +287,6 @@
-
-
-
-
-
-
-
-
-
@@ -325,10 +314,10 @@
-
+
-
+
@@ -337,6 +326,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -355,24 +371,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -492,8 +490,6 @@
@@ -880,7 +878,41 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -894,38 +926,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1020,65 +1020,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1172,6 +1114,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1338,14 +1336,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
localhost
@@ -1481,7 +1479,7 @@
-
+
@@ -1494,7 +1492,6 @@
-
@@ -1519,6 +1516,7 @@
+
@@ -1528,27 +1526,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1635,7 +1612,7 @@
-
+
@@ -1643,6 +1620,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/translator/test/org/jetbrains/k2js/test/FunctionTest.java b/translator/test/org/jetbrains/k2js/test/FunctionTest.java
index 133a6e1fa65..a8d7ef85769 100644
--- a/translator/test/org/jetbrains/k2js/test/FunctionTest.java
+++ b/translator/test/org/jetbrains/k2js/test/FunctionTest.java
@@ -79,6 +79,11 @@ public class FunctionTest extends AbstractExpressionTest {
testFooBoxIsTrue("namedArguments.kt");
}
+ @Test
+ public void expressionAsFunction() throws Exception {
+ testFooBoxIsTrue("expressionAsFunction.kt");
+ }
+
@Test
public void kt921() throws Exception {
try {
diff --git a/translator/testFiles/expression/function/cases/expressionAsFunction.kt b/translator/testFiles/expression/function/cases/expressionAsFunction.kt
new file mode 100644
index 00000000000..a2f0685ae29
--- /dev/null
+++ b/translator/testFiles/expression/function/cases/expressionAsFunction.kt
@@ -0,0 +1,42 @@
+package foo
+
+import java.util.*;
+
+val d = {(a : Int) -> a + 1}
+val p = {(a : Int) -> a * 3}
+
+val list = ArrayList>();
+
+fun chain(start : Int) : Int {
+ var res = start;
+ for (func in list) {
+ res = (func)(res);
+ }
+ return res;
+}
+
+fun box() : Boolean {
+ if (chain(0) != 0) {
+ return false;
+ }
+ list.add(d);
+ if (list.get(0)(0) != 1) {
+ return false;
+ }
+ list.add(p);
+ if (list.get(1)(10) != 30) {
+ return false;
+ }
+ if (chain(0) != 3) {
+ return false;
+ }
+ list.add({it * it});
+ list.add({it - 100});
+ if (chain(2) != -19) {
+ return false;
+ }
+ if (({(a : Int) -> a * a}(3)) != 9) {
+ return false;
+ }
+ return true;
+}
\ No newline at end of file