You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I talked about this on Discord with Gears, and he thinks this is actually a bug worth reporting 😄
When the compiler introduces auto-generated type variable names for reporting errors (and in the LSP), 1.5.1 always starts at a. The nightly release of the compiler instead seems to reserve explicitly annotated type variable names used elsewhere in the module. This means that the names generated will not usually start with a, but rather with the next free letter.
importgleam/iotypeWibble(a, b, c, d, e, f, g){Wibble(value: a)}fnwibble(value: h){io.debug(value)Nil}fnwobble(){letx:List(i)=[]wibble(x)wibble(fn()->List(j){[]})}pubfnmain(){letx:Nil=[]}
produces:
error: Type mismatch
┌─ C:\Users\joshua\Documents\globe\src\globe.gleam:19:16
│
18 │ let x: Nil = []
│ ^^
Expected type:
Nil
Found type:
List(k)
type variables a..j are reserved because of the other usages above.
I ran git bisect and figured out this was introduced in 8c5834b
~ 💜
The text was updated successfully, but these errors were encountered:
The correct behaviour here would be to only track type variable names in the current function, rather than the whole module. This would require a rework of the Names class.
This is pretty low priority as it still produces correct annotations, even if somewhat redundant ones.
lpil
changed the title
Nightly: Type variable names used in the module are now reserved for the whole module
Error's type printing: Consider only annotated type variables for the current definition rather than the whole module
Nov 4, 2024
I talked about this on Discord with Gears, and he thinks this is actually a bug worth reporting 😄
When the compiler introduces auto-generated type variable names for reporting errors (and in the LSP), 1.5.1 always starts at
a
. The nightly release of the compiler instead seems to reserve explicitly annotated type variable names used elsewhere in the module. This means that the names generated will not usually start witha
, but rather with the next free letter.produces:
type variables a..j are reserved because of the other usages above.
I ran
git bisect
and figured out this was introduced in 8c5834b~ 💜
The text was updated successfully, but these errors were encountered: