diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 8af80b9b6f8..5bdbd5bf7d0 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -431,6 +431,31 @@ task localClass_noPrimaryConstructor(type: RunKonanTest) { source = "codegen/localClass/noPrimaryConstructor.kt" } +task localClass_localFunctionCallFromLocalClass(type: RunKonanTest) { + goldValue = "OK\n" + source = "codegen/localClass/localFunctionCallFromLocalClass.kt" +} + +task localClass_localFunctionInLocalClass(type: RunKonanTest) { + goldValue = "OK\n" + source = "codegen/localClass/localFunctionInLocalClass.kt" +} + +task function_localFunction(type : RunKonanTest) { + goldValue = "OK\n" + source = "codegen/function/localFunction.kt" +} + +task function_localFunction2(type : RunKonanTest) { + goldValue = "OK\n" + source = "codegen/function/localFunction2.kt" +} + +task function_localFunction3(type : RunKonanTest) { + goldValue = "OK\n" + source = "codegen/function/localFunction3.kt" +} + task initializers_correctOrder1(type: RunKonanTest) { goldValue = "42\n" source = "codegen/initializers/correctOrder1.kt" diff --git a/backend.native/tests/codegen/function/localFunction.kt b/backend.native/tests/codegen/function/localFunction.kt new file mode 100644 index 00000000000..d50382ac0c9 --- /dev/null +++ b/backend.native/tests/codegen/function/localFunction.kt @@ -0,0 +1,11 @@ +fun main(args : Array) { + val x = 1 + fun local0() = println(x) + fun local1() { + fun local2() { + local1() + } + local0() + } + println("OK") +} \ No newline at end of file diff --git a/backend.native/tests/codegen/function/localFunction3.kt b/backend.native/tests/codegen/function/localFunction3.kt new file mode 100644 index 00000000000..5ff19aa6c3c --- /dev/null +++ b/backend.native/tests/codegen/function/localFunction3.kt @@ -0,0 +1,16 @@ +fun main(args : Array) { + fun bar() { + fun local1() { + bar() + } + local1() + + var x = 0 + fun local2() { + x++ + bar() + } + local2() + } + println("OK") +} \ No newline at end of file diff --git a/backend.native/tests/codegen/innerClass/localFunctionCallFromLocalClass.kt b/backend.native/tests/codegen/innerClass/localFunctionCallFromLocalClass.kt new file mode 100644 index 00000000000..469209e409d --- /dev/null +++ b/backend.native/tests/codegen/innerClass/localFunctionCallFromLocalClass.kt @@ -0,0 +1,14 @@ +fun main(args : Array) { + var x = 1 + fun local1() { + x++ + } + + class A { + fun bar() { + local1() + } + } + A().bar() + println("OK") +} \ No newline at end of file