-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unifier error messages appear in the wrong place #338
Comments
Hey, thanks for reporting this issue. We do indeed need to improve our error messages; I think there are more examples. To fix this, the spans supplied to the type errors need to be adjusted. The errors are defined in https://github.com/polarity-lang/polarity/blob/main/lang/elaborator/src/result.rs. From there, one can find all references of individual errors in the codebase. |
it appears that there's just the
It looks like the span is there but only in Is this expected? I think this is why it is missing in the error. |
I have traced back this empty span for |
The reason for optional spans are the de/refunctionalization code actions. If a file gets parsed, lowered, typechecked, then all the spans should be (I am currently winding down from a week of OOPSLA, but I will have some time in the next few days to take a closer look :) ) Edit: Another reason is elaborated type information: When we annotate some subterm with an inferred type, then that type is represented by an AST, but it does not correspond to some text written by the user. |
This, but also syntactic sugar and substitution during elaboration (dependent pattern matching). |
Okay, so what I think happens in this particular example is the following: In the declaration In
This does not have a span simply because it does not occur in the program. The spans in the ast are correct, but these are probably not the spans we want to use for this error message. |
For instance, if you change the program to:
The error message changes to:
Which is better but it is still missing the information where the error originated from in |
Yeah… it would be good to annotate why it is trying to unify A and B and then put that in the error. |
Hi! The error messages after unifying seem to appear in the wrong place. Simple example:
In this example I expect
C
to be authoritative and the error to be reported on the type off
, however, the error is on the parameter onC
.this also happens with other errors like T-016 "Cannot automatically decided whether lhs and rhs unify"
The text was updated successfully, but these errors were encountered: