gluon-lang / gluon

A static, type inferred and embeddable language written in Rust.
https://gluon-lang.org
MIT License
3.19k stars 145 forks source link

The error message on unresolved implicits are poor if implicits are imported via `{ ? }` #457

Open Marwes opened 6 years ago

Marwes commented 6 years ago

If an implicit argument could not be resolved the typechecker displays a list of all bindings that were considered. This works well for bindings that can be refereed to directly but when an implicit were imported via { ? } there is no proper binding to refer to.

What happens instead is that the error will display implicit?<number> which is the name of a generated variable.

let { ? } = import! std.option
let { List } = import! std.list
Cons 1 Nil == Nil
// ^ Unable to resolve impliciit ... candidates: implicit?123.eq, ...
Marwes commented 6 years ago

One way of fixing this would be to make implicit imports (?) be bound on identifiers instead of records. That way there is always an identifier to refer to.

Another way would be to track the position of the import better and say something akin to

Unable to resolve implicit candidates:
eq: Eq String imported from line x, column y
let { ? } = import! std.string
      ^
...