-
Notifications
You must be signed in to change notification settings - Fork 380
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
[ refactor ] Multiline error report #1155
Conversation
andrevidela
commented
Mar 4, 2021
•
edited
Loading
edited
- Parser errors can now take bounds for better diagnostics
- fix Reporting single-quoted multi-line strings #1133
24c2828
to
1d692da
Compare
ready for review @gallais |
I'm still confused by why |
It's explained in the commit message. Essentially, Almost all signatures return Edit: I just realised you're suggesting to return the token directly when there are no bounds. I haven't tried that but I suspect it would make current:
updated:
It doesn't even capture the invariant properly since if either the bounds are valid the result should have valid bounds, we could update this to carry proofs about |
Is there any concrete case where the proof is used? |
Basically everywhere its using |
I still can't figure out why the type-level proof for valid bound is necessary. (1) |
Every calls to the constructor |
I think it should be fine to return an empty (col 0, row 0) |
Yes this is correct, technically speaking you don't need the additional invariant because you can return a sentinel value just fine. In fact this is what most software does in practice, programming languages like Go or C do this routinely since they do not have ADTs. This is also what the previous implementation did by returning bounds of However I don't believe this is the right move when developing software. We have the opportunity to both document and enforce an invariant that we know should result in inaccurate diagnostics if broken (those are also particularly hard to notice since they don't result in runtime error). Maybe you're worried about the runtime performance, but it should be the same. That's because the flag simply moved position in the struct that the codegen uses for |
I agree with @zhongzc, but I rather worry about the balance between the assumption explicitness and the development efficiency. Even if Idris is more powerful in expressiveness than others, we should still think twice when we are able to use the power -- is it necessary? does it bring us runtime cost? is it harder to understand? In this case, I think the overwhelming syntax noise is not deserved by the only one (maybe not any) special case. Not only that, I think the special case is still well handled by the internal dynamical |
1d692da
to
359667a
Compare
I couldn't figure out what was wrong with the out-of-files bounds so I've reverted the changes to |
359667a
to
05cc5b7
Compare
@andrevidela A bug breaking the CI has been fixed by #1189. You need to rebase on the master. |
05cc5b7
to
485057c
Compare
485057c
to
36e2de9
Compare