fram-lang / fram-lang/dbl

Better location-tracking in the generated code

Open
#230 0 comments 0 reactions 0 assignees View on GitHub
1. type inference 2. effect inference error messages
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.