Added a simple fix to make type-checking better for the Let type.
Previously, the following program would return a nonsense error Symbol "B" not defined:
const putint = proc(i: Int) -> None = std {
put-int [SP]
pop
} in
type List = let B = let T = Int in (T, &B) in B in
let x = (3, Null),
y = (2, &x),
z: List = (1, &y),
in putint(z.1->1->0)
This should not fail, but it's due to a simple bug caused by not simplifying the Let type before returning in get_member_offset, causing undefined symbols (which are defined in the Let scope) to be left in the returned type.
Now, the following program type-checks as expected:
const putint = proc(i: Int) -> None = std {
put-int [SP]
pop
} in
type List = let B = let T = Int in (T, &B) in B in
let x = (3, Null),
y = (2, &x),
z: (let A = (Int, &A) in A) = (1, &y),
w: List = (0, &z)
in putint(w.1->1->1->0)
Added a simple fix to make type-checking better for the
Let
type.Previously, the following program would return a nonsense error
Symbol "B" not defined
:This should not fail, but it's due to a simple bug caused by not simplifying the
Let
type before returning inget_member_offset
, causing undefined symbols (which are defined in theLet
scope) to be left in the returned type.Now, the following program type-checks as expected: