Better location-tracking in the generated code
- Dominant language
- OCaml
- Stars
- 45
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
The type-checking phase generates some code, that was not typed by the user. When error occur during effect inference in such a piece of code, the error message might be misleading. For instance, the code
```
data T = C of { ~x : String ->[] Unit }
let ~x = printStrLn
let f () = C
```
generates the following error.
```
fatal error: This expression has type String ->[IO] Unit, but an expression was expected of type String ->[] Unit
Cannot ensure that IO is a subeffect of []
Effect variable IO escapes its scope.
-> test.fram
1 | data T = C of { ~x : String ->[] Unit }
2 | let ~x = printStrLn
3 |>let f () = C
|
```
We could define a special type of enhanced positions, that would be attached to AST nodes in Unif. Such positions could contain some extra information about the origin of the generated code, to help the user to find an actual error.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.