diff --git a/compiler/testData/codegen/script/secondLevelFunction.ktscript b/compiler/testData/codegen/script/secondLevelFunction.ktscript new file mode 100644 index 00000000000..56b56d2c00e --- /dev/null +++ b/compiler/testData/codegen/script/secondLevelFunction.ktscript @@ -0,0 +1,10 @@ +val x: Int + +if (true) { + fun foo(y: Int) = y + 20 + x = foo(9) +} + +x + +// expected: 29 diff --git a/compiler/testData/codegen/script/secondLevelFunctionClosure.ktscript b/compiler/testData/codegen/script/secondLevelFunctionClosure.ktscript new file mode 100644 index 00000000000..ff3f4170578 --- /dev/null +++ b/compiler/testData/codegen/script/secondLevelFunctionClosure.ktscript @@ -0,0 +1,11 @@ +val z = 30 +val x: Int + +if (true) { + fun foo() = z + 20 + x = foo() +} + +x + +// expected: 50 diff --git a/compiler/tests/org/jetbrains/jet/codegen/ScriptGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ScriptGenTest.java index b9e4a839868..377d24b5193 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/ScriptGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/ScriptGenTest.java @@ -46,6 +46,14 @@ public class ScriptGenTest extends CodegenTestCase { blackBoxFile("script/topLevelFunctionClosure.ktscript"); } + public void testSecondLevelFunction() { + blackBoxFile("script/secondLevelFunction.ktscript"); + } + + public void testSecondLevelFunctionClosure() { + blackBoxFile("script/secondLevelFunctionClosure.ktscript"); + } + public void testScriptParameter() { blackBoxFile("script/parameter.ktscript"); }