pyret-lang icon indicating copy to clipboard operation
pyret-lang copied to clipboard

Type inference error when assigning `link(...)` to `var lst = [list:]`

Open ironm00n opened this issue 5 months ago • 0 comments

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)
CPO Screenshots Image

ironm00n avatar Jul 28 '25 20:07 ironm00n