backend/tests: Add tests for local function closures

This commit is contained in:
Ilya Matveev
2017-02-10 16:49:23 +03:00
committed by ilmat192
parent 8004b3d096
commit 95a9f65afd
4 changed files with 66 additions and 0 deletions
@@ -0,0 +1,11 @@
fun main(args : Array<String>) {
val x = 1
fun local0() = println(x)
fun local1() {
fun local2() {
local1()
}
local0()
}
println("OK")
}
@@ -0,0 +1,16 @@
fun main(args : Array<String>) {
fun bar() {
fun local1() {
bar()
}
local1()
var x = 0
fun local2() {
x++
bar()
}
local2()
}
println("OK")
}
@@ -0,0 +1,14 @@
fun main(args : Array<String>) {
var x = 1
fun local1() {
x++
}
class A {
fun bar() {
local1()
}
}
A().bar()
println("OK")
}