Open Marwes opened 8 years ago
The above is just an idea, might be a good idea to look at how Elm represents it as well
This seems to be the root of the error reporting in the elm compiler: https://github.com/elm-lang/elm-compiler/tree/master/src/Reporting
I did the the setup needed for this a while ago (see https://github.com/gluon-lang/gluon/blob/c450475fdca856580a6ec9a6854e0d5352eceb9e/check/src/typecheck.rs#L156-L158 ).
To continue on this just add another variant to enum Help
which contains AstLocation
. Then do as explained in https://github.com/gluon-lang/gluon/issues/145#issue-175042640
We should have better, more human readable error messages. Elm has had a fair amount of praise for its error messages so stealing some ideas from it should be a good idea http://elm-lang.org/blog/compiler-errors-for-humans. From the blog post we can see that the error messages contain not only row and column information about where the error occurs but also that the error occurred in the 1st argument.
To do this we may add an enum as below in addition the the current
Span
which would meaning changing the signature of unify_span to take anAstLocation
as well which each caller needs to supply with the extra information (which might need to be optional, at least to start with).This can be a bit bigger project but just adding a few
AstLocation
's may be good starting project.