Pseudocode: Implement computation of expected type predicates
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
== Bar ==
|
||||
class Bar {
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== Foo ==
|
||||
class Foo() {
|
||||
fun Bar.invoke() {}
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== invoke ==
|
||||
fun Bar.invoke() {}
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
2 mark({})
|
||||
read (Unit)
|
||||
L1:
|
||||
1 <END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== foobar ==
|
||||
fun foobar(f: Foo) {
|
||||
Bar().f()
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
v(f: Foo)
|
||||
magic(f: Foo) -> <v0>
|
||||
w(f|<v0>)
|
||||
2 mark({ Bar().f() })
|
||||
mark(Bar().f())
|
||||
r(f) -> <v1>
|
||||
mark(Bar())
|
||||
call(Bar, <init>) -> <v2>
|
||||
mark(f())
|
||||
call(f, invoke|<v1>, <v2>) -> <v3>
|
||||
L1:
|
||||
1 <END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
@@ -0,0 +1,10 @@
|
||||
class Bar {
|
||||
}
|
||||
|
||||
class Foo() {
|
||||
fun Bar.invoke() {}
|
||||
}
|
||||
|
||||
fun foobar(f: Foo) {
|
||||
Bar().f()
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
== Bar ==
|
||||
class Bar {
|
||||
}
|
||||
---------------------
|
||||
=====================
|
||||
== Foo ==
|
||||
class Foo() {
|
||||
fun Bar.invoke() {}
|
||||
}
|
||||
---------------------
|
||||
=====================
|
||||
== invoke ==
|
||||
fun Bar.invoke() {}
|
||||
---------------------
|
||||
=====================
|
||||
== foobar ==
|
||||
fun foobar(f: Foo) {
|
||||
Bar().f()
|
||||
}
|
||||
---------------------
|
||||
Bar() <v2>: Bar NEW()
|
||||
f <v1>: Foo NEW()
|
||||
f() <v3>: * NEW(<v1>, <v2>)
|
||||
Bar().f() <v3>: * COPY
|
||||
{ Bar().f() } <v3>: * COPY
|
||||
=====================
|
||||
@@ -4,7 +4,7 @@ fun foo(a: Int, b: Int) {
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
a <v2> NEW()
|
||||
b <v3> NEW()
|
||||
a == b <v4> NEW(<v2>, <v3>)
|
||||
a <v2>: OR{{<: Any}, {<: Any}} NEW()
|
||||
b <v3>: {<: Any?} NEW()
|
||||
a == b <v4>: Boolean NEW(<v2>, <v3>)
|
||||
=====================
|
||||
|
||||
@@ -4,8 +4,8 @@ fun foo() {
|
||||
i++
|
||||
}
|
||||
---------------------
|
||||
1 <v0> NEW()
|
||||
i <v1> NEW()
|
||||
i++ <v1> COPY
|
||||
{ var i = 1 i++ } <v1> COPY
|
||||
1 <v0>: Int NEW()
|
||||
i <v1>: Int NEW()
|
||||
i++ <v1>: Int COPY
|
||||
{ var i = 1 i++ } <v1>: Int COPY
|
||||
=====================
|
||||
|
||||
@@ -3,7 +3,7 @@ fun foo(f: () -> Unit) {
|
||||
f()
|
||||
}
|
||||
---------------------
|
||||
f <v1> NEW()
|
||||
f() <v2> NEW(<v1>)
|
||||
{ f() } <v2> COPY
|
||||
f <v1>: {<: () -> Unit} NEW()
|
||||
f() <v2>: * NEW(<v1>)
|
||||
{ f() } <v2>: * COPY
|
||||
=====================
|
||||
|
||||
@@ -3,7 +3,7 @@ fun neq(a: Int, b: Int) {
|
||||
if (a != b) {}
|
||||
}
|
||||
---------------------
|
||||
a <v2> NEW()
|
||||
b <v3> NEW()
|
||||
a != b <v4> NEW(<v2>, <v3>)
|
||||
a <v2>: OR{{<: Any}, {<: Any}} NEW()
|
||||
b <v3>: {<: Any?} NEW()
|
||||
a != b <v4>: Boolean NEW(<v2>, <v3>)
|
||||
=====================
|
||||
|
||||
Reference in New Issue
Block a user