pyret-lang
pyret-lang copied to clipboard
Type inference error when assigning `link(...)` to `var lst = [list:]`
The following code is unable to type check:
var lst = [list:]
lst := link(1, lst)
Resulting in the following error:
The type checker rejected the expression
`lst := link(1, !lst)`
because the expression at file:///path/to/repro.arr:2:0-2:19 was of type `forall A . ref (List<A> % is-empty)` but it was expected to be of type `ref forall A . ref (List<A> % is-empty)` because of file:///path/to/repro.arr:2:0-2:19
Notably the following does type check:
var lst :: List<Number> = [list:]
lst := link(1, lst)