Pseudocode: Implement computation of expected type predicates

This commit is contained in:
Alexey Sedunov
2014-06-23 14:02:22 +04:00
parent 50228fa085
commit 5e2c2b4eca
87 changed files with 1154 additions and 803 deletions
@@ -7,6 +7,6 @@ tailRecursive fun test() : Int {
}
}
---------------------
test() <v0> NEW()
{ test() } <v0> COPY
test() <v0>: * NEW()
{ test() } <v0>: * COPY
=====================
@@ -7,5 +7,5 @@ tailRecursive fun test() : Int {
}
}
---------------------
test() <v0> NEW()
test() <v0>: Int NEW()
=====================
+13 -13
View File
@@ -4,17 +4,17 @@ tailRecursive fun sum(x: Long, sum: Long): Long {
return sum(x - 1, sum + x)
}
---------------------
x <v2> NEW()
0 <v3> NEW()
toLong() <v4> NEW(<v3>)
0.toLong() <v4> COPY
x == 0.toLong() <v5> NEW(<v2>, <v4>)
sum <v6> NEW()
x <v7> NEW()
1 <v8> NEW()
x - 1 <v9> NEW(<v7>, <v8>)
sum <v10> NEW()
x <v11> NEW()
sum + x <v12> NEW(<v10>, <v11>)
sum(x - 1, sum + x) <v13> NEW(<v9>, <v12>)
x <v2>: OR{{<: Any}, {<: Any}} NEW()
0 <v3>: {<: Number} NEW()
toLong() <v4>: {<: Any?} NEW(<v3>)
0.toLong() <v4>: {<: Any?} COPY
x == 0.toLong() <v5>: Boolean NEW(<v2>, <v4>)
sum <v6>: Long NEW()
x <v7>: Long NEW()
1 <v8>: Int NEW()
x - 1 <v9>: Long NEW(<v7>, <v8>)
sum <v10>: Long NEW()
x <v11>: Long NEW()
sum + x <v12>: Long NEW(<v10>, <v11>)
sum(x - 1, sum + x) <v13>: Long NEW(<v9>, <v12>)
=====================
+1 -1
View File
@@ -7,5 +7,5 @@ tailRecursive fun foo() {
}
}
---------------------
foo() <v0> NEW()
foo() <v0>: Unit NEW()
=====================
@@ -9,12 +9,12 @@ fun test() : Unit {
}
}
---------------------
test() <v0> NEW()
{ test() } <v0> COPY
test() <v2> NEW()
{ test() } <v2> COPY
test() <v3> NEW()
{ test() } <v3> COPY
try { test() } catch (any : Exception) { test() } finally { test() } <v4> NEW(<v0>, <v2>)
{ try { test() } catch (any : Exception) { test() } finally { test() } } <v4> COPY
test() <v0>: * NEW()
{ test() } <v0>: * COPY
test() <v2>: * NEW()
{ test() } <v2>: * COPY
test() <v3>: * NEW()
{ test() } <v3>: * COPY
try { test() } catch (any : Exception) { test() } finally { test() } <v4>: * NEW(<v0>, <v2>)
{ try { test() } catch (any : Exception) { test() } finally { test() } } <v4>: * COPY
=====================