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
{{ message }}
Repository navigation
Commit 4bc3193
Browse filesBrowse the repository at this point in the historyBrowse files
Show existential types as $a and name their constructor
Why:
An existential type of a GADT constructor is an abstract type named
`$Any_'a` internally, and that name was printed as is in errors and
hover. It is now printed `$a`, as in OCaml 5, and the escape error
says which constructor binds it instead of calling it a type
constructor.
Diagnostic modified (existential escape):
Example:
type rec any = Any('a): any
let get = (Any(x)) => x
Before (diagnostic):
This has type: $Any_'a
But it's expected to have type: 'a
The type constructor $Any_'a would escape its scope
After (diagnostic):
This has type: $a
But it's expected to have type: 'a
$a is an existential type bound by the constructor Any.
It is only known in the scope of the pattern that matches Any.
Review: Why decode the name instead of recording the constructor?
The name already holds both parts, so printing needs no table that
would have to be reset between compilations in one process.
Fixes: #9068
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLMawVgtmiKy3TMBc3
Signed-off-by: Christoph Knittel <ck@cca.io>
- Existential types of GADT constructors are shown as `$a` instead of `$Any_'a`, and an escaping one is explained by naming the constructor that binds it.
0 commit comments