Files
kotlin-fork/compiler/testData/cfg-variables/basic/UseUninitializedInLambda.instructions
T
Mikhail Glukhikh fe13f39de9 Use of uninitialized variables in lambdas / object literals / local functions is forbidden now #KT-4475 Fixed
Local declarations CFA: variable initialization information before them is now taken into account
2015-11-17 18:21:09 +03:00

61 lines
2.3 KiB
Plaintext
Vendored

== bar ==
fun bar(f: () -> Unit) = f()
---------------------
L0:
1 <START> INIT: in: {} out: {}
v(f: () -> Unit) INIT: in: {} out: {f=D}
magic[FAKE_INITIALIZER](f: () -> Unit) -> <v0> INIT: in: {f=D} out: {f=D}
w(f|<v0>) INIT: in: {f=D} out: {f=ID} USE: in: {f=READ} out: {f=READ}
r(f) -> <v1> INIT: in: {f=ID} out: {f=ID} USE: in: {} out: {f=READ}
mark(f())
call(f(), invoke|<v1>) -> <v2>
ret(*|<v2>) L1
L1:
<END>
error:
<ERROR> INIT: in: {} out: {}
sink:
<SINK> INIT: in: {f=ID} out: {f=ID} USE: in: {} out: {}
=====================
== foo ==
fun foo() {
var v: Any
bar { v.hashCode() }
}
---------------------
L0:
1 <START> INIT: in: {} out: {} USE: in: {} out: {}
2 mark({ var v: Any bar { v.hashCode() } })
v(var v: Any) INIT: in: {} out: {v=D}
mark({ v.hashCode() }) INIT: in: {v=D} out: {v=D}
jmp?(L2)
d({ v.hashCode() }) USE: in: {v=READ} out: {v=READ}
L2 [after local declaration]:
r({ v.hashCode() }) -> <v0>
mark(bar { v.hashCode() })
call(bar { v.hashCode() }, bar|<v0>) -> <v1>
L1:
1 <END> INIT: in: {} out: {}
error:
<ERROR>
sink:
<SINK> USE: in: {} out: {}
=====================
== anonymous_0 ==
{ v.hashCode() }
---------------------
L3:
3 <START> INIT: in: {v=D} out: {v=D}
4 mark(v.hashCode())
mark(v.hashCode()) USE: in: {v=READ} out: {v=READ}
r(v) -> <v0> USE: in: {} out: {v=READ}
mark(hashCode())
call(hashCode(), hashCode|<v0>) -> <v1>
L4:
3 <END>
error:
<ERROR> INIT: in: {} out: {}
sink:
<SINK> INIT: in: {v=D} out: {v=D} USE: in: {} out: {}
=====================