Pseudocode: Generate fake values for Unit/Nothing-typed expressions

This commit is contained in:
Alexey Sedunov
2014-07-23 12:56:21 +04:00
parent 2d3ac9109b
commit 77bbf8f73b
72 changed files with 851 additions and 592 deletions
@@ -7,16 +7,16 @@ L0:
1 <START>
2 mark({ false || (return false) })
r(false) -> <v0>
jt(L2|<v0>) NEXT:[mark((return false)), magic[OR](false || (return false)|<v0>) -> <v2>]
jt(L2|<v0>) NEXT:[mark((return false)), magic[OR](false || (return false)|<v0>, !<v2>) -> <v3>]
mark((return false))
r(false) -> <v1>
ret(*|<v1>) L1 NEXT:[<END>]
ret(*|<v1>) L1 NEXT:[<END>]
L2:
magic[OR](false || (return false)|<v0>) -> <v2> PREV:[jt(L2|<v0>)]
magic[OR](false || (return false)|<v0>, !<v2>) -> <v3> PREV:[jt(L2|<v0>)]
L1:
1 <END> NEXT:[<SINK>] PREV:[ret(*|<v1>) L1, magic[OR](false || (return false)|<v0>) -> <v2>]
1 <END> NEXT:[<SINK>] PREV:[ret(*|<v1>) L1, magic[OR](false || (return false)|<v0>, !<v2>) -> <v3>]
error:
<ERROR> PREV:[]
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
<SINK> PREV:[<ERROR>, <END>]
=====================
@@ -3,8 +3,10 @@ fun blockAndAndMismatch() : Boolean {
false || (return false)
}
---------------------
false <v0>: Boolean NEW: r(false) -> <v0>
false <v1>: Boolean NEW: r(false) -> <v1>
false || (return false) <v2>: * NEW: magic[OR](false || (return false)|<v0>) -> <v2>
{ false || (return false) } <v2>: * COPY
false <v0>: Boolean NEW: r(false) -> <v0>
false <v1>: Boolean NEW: r(false) -> <v1>
return false !<v2>: *
(return false) !<v2>: * COPY
false || (return false) <v3>: * NEW: magic[OR](false || (return false)|<v0>, !<v2>) -> <v3>
{ false || (return false) } <v3>: * COPY
=====================
@@ -48,7 +48,7 @@ L0:
- call(bar(), bar) PREV:[]
- jmp(error) NEXT:[<ERROR>] PREV:[]
- mark(doSomething) PREV:[]
- call(doSomething, doSomething) -> <v3> PREV:[]
- call(doSomething, doSomething|!<v3>) -> <v4> PREV:[]
L1:
1 <END> NEXT:[<SINK>] PREV:[]
error:
@@ -13,11 +13,12 @@ fun foo() {
bar().doSomething
}
---------------------
null <v0>: * NEW: r(null) -> <v0>
null!! <v1>: * NEW: magic[NOT_NULL_ASSERTION](null!!|<v0>) -> <v1>
doSomething() <v2>: * NEW: call(doSomething(), doSomething|<v1>) -> <v2>
null!!.doSomething() <v2>: * COPY
doSomething <v3>: * NEW: call(doSomething, doSomething) -> <v3>
bar().doSomething <v3>: * COPY
{ null!!.doSomething() bar().doSomething } <v3>: * COPY
null <v0>: * NEW: r(null) -> <v0>
null!! <v1>: * NEW: magic[NOT_NULL_ASSERTION](null!!|<v0>) -> <v1>
doSomething() <v2>: * NEW: call(doSomething(), doSomething|<v1>) -> <v2>
null!!.doSomething() <v2>: * COPY
bar() !<v3>: *
doSomething <v4>: * NEW: call(doSomething, doSomething|!<v3>) -> <v4>
bar().doSomething <v4>: * COPY
{ null!!.doSomething() bar().doSomething } <v4>: * COPY
=====================
@@ -7,11 +7,11 @@ L0:
1 <START>
2 mark({ this() })
mark(this())
call(this(), invoke) -> <v0>
call(this(), invoke|!<v0>) -> <v1>
L1:
1 <END> NEXT:[<SINK>]
1 <END> NEXT:[<SINK>]
error:
<ERROR> PREV:[]
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
<SINK> PREV:[<ERROR>, <END>]
=====================
@@ -3,6 +3,8 @@ fun Function0<Unit>.foo() {
this()
}
---------------------
this() <v0>: * NEW: call(this(), invoke) -> <v0>
{ this() } <v0>: * COPY
=====================
this !<v0>: * COPY
this !<v0>: *
this() <v1>: * NEW: call(this(), invoke|!<v0>) -> <v1>
{ this() } <v1>: * COPY
=====================
@@ -14,11 +14,11 @@ L0:
error(foo, No resolved call)
r(a) -> <v1>
mark(foo())
magic[UNRESOLVED_CALL](foo()|<v1>) -> <v2>
magic[UNRESOLVED_CALL](foo()|!<v2>, <v1>) -> <v3>
L1:
1 <END> NEXT:[<SINK>]
1 <END> NEXT:[<SINK>]
error:
<ERROR> PREV:[]
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
<SINK> PREV:[<ERROR>, <END>]
=====================
@@ -3,9 +3,10 @@ fun test(a: Any) {
a.foo()
}
---------------------
<v0>: {<: Any} NEW: magic[FAKE_INITIALIZER](a: Any) -> <v0>
a <v1>: * NEW: r(a) -> <v1>
foo() <v2>: * NEW: magic[UNRESOLVED_CALL](foo()|<v1>) -> <v2>
a.foo() <v2>: * COPY
{ a.foo() } <v2>: * COPY
<v0>: {<: Any} NEW: magic[FAKE_INITIALIZER](a: Any) -> <v0>
a <v1>: * NEW: r(a) -> <v1>
foo !<v2>: *
foo() <v3>: * NEW: magic[UNRESOLVED_CALL](foo()|!<v2>, <v1>) -> <v3>
a.foo() <v3>: * COPY
{ a.foo() } <v3>: * COPY
=====================