Added some corner tests on escape analysis
This commit is contained in:
@@ -1757,6 +1757,16 @@ task memory_throw_cleanup(type: RunKonanTest) {
|
||||
source = "runtime/memory/throw_cleanup.kt"
|
||||
}
|
||||
|
||||
task memory_escape1(type: RunKonanTest) {
|
||||
goldValue = "zzz\n"
|
||||
source = "runtime/memory/escape1.kt"
|
||||
}
|
||||
|
||||
task memory_escape2(type: RunKonanTest) {
|
||||
goldValue = "zzz\n"
|
||||
source = "runtime/memory/escape2.kt"
|
||||
}
|
||||
|
||||
task unit1(type: RunKonanTest) {
|
||||
goldValue = "First\nkotlin.Unit\n"
|
||||
source = "codegen/basics/unit1.kt"
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
class B(val s: String)
|
||||
|
||||
class A {
|
||||
val b = B("zzz")
|
||||
}
|
||||
|
||||
fun foo(): B {
|
||||
val a = A()
|
||||
return a.b
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
println(foo().s)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
class A(val s: String)
|
||||
|
||||
class B {
|
||||
var a: A? = null
|
||||
}
|
||||
|
||||
class C(val b: B)
|
||||
|
||||
fun foo(c: C) {
|
||||
c.b.a = A("zzz")
|
||||
}
|
||||
|
||||
fun bar(b: B) {
|
||||
val c = C(b)
|
||||
foo(c)
|
||||
}
|
||||
|
||||
val global = B()
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
bar(global)
|
||||
println(global.a!!.s)
|
||||
}
|
||||
Reference in New Issue
Block a user