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
This commit is contained in:
Mikhail Glukhikh
2015-11-11 13:05:40 +03:00
parent 89791dc85c
commit fe13f39de9
26 changed files with 245 additions and 105 deletions
@@ -30,12 +30,12 @@ sink:
fun local(x: Int) = x + b
---------------------
L3:
3 <START> INIT: in: {} out: {}
v(x: Int) INIT: in: {} out: {x=D}
magic[FAKE_INITIALIZER](x: Int) -> <v0> INIT: in: {x=D} out: {x=D}
w(x|<v0>) INIT: in: {x=D} out: {x=ID} USE: in: {b=READ, x=READ} out: {b=READ, x=READ}
r(x) -> <v1> INIT: in: {x=ID} out: {x=ID} USE: in: {b=READ} out: {b=READ, x=READ}
r(b) -> <v2> USE: in: {} out: {b=READ}
3 <START> INIT: in: {b=ID} out: {b=ID}
v(x: Int) INIT: in: {b=ID} out: {b=ID, x=D}
magic[FAKE_INITIALIZER](x: Int) -> <v0> INIT: in: {b=ID, x=D} out: {b=ID, x=D}
w(x|<v0>) INIT: in: {b=ID, x=D} out: {b=ID, x=ID} USE: in: {b=READ, x=READ} out: {b=READ, x=READ}
r(x) -> <v1> INIT: in: {b=ID, x=ID} out: {b=ID, x=ID} USE: in: {b=READ} out: {b=READ, x=READ}
r(b) -> <v2> USE: in: {} out: {b=READ}
mark(x + b)
call(x + b, plus|<v1>, <v2>) -> <v3>
ret(*|<v3>) L4
@@ -44,5 +44,5 @@ L4:
error:
<ERROR> INIT: in: {} out: {}
sink:
<SINK> INIT: in: {x=ID} out: {x=ID} USE: in: {} out: {}
<SINK> INIT: in: {b=ID, x=ID} out: {b=ID, x=ID} USE: in: {} out: {}
=====================