-
Notifications
You must be signed in to change notification settings - Fork 214
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
Add source position information for missing imports #812
Conversation
Related to #561 This adds source position information to missing imports Before: ``` $ dhall <<< './foo' ↳ ./foo Error: Missing file …/foo ``` After: ``` $ dhall <<< './foo' ↳ ./foo Error: Missing file …/foo (stdin):1:1 ```
Awesome, I think I can work with this. Now my next request would be to show a |
@Profpatsch: Yeah, that will follow in another pull request (possibly replacing exceptions with something like |
I approve of this. It’s so darn hard to follow the exception codepaths. |
Ah, the position of the imports in the source files are not yet available though, I get
I would expect the error position to point to the file name on line 2 of Oh, and if I have
I need some way to point to the import of |
Something like |
.. as caught by @Profpatsch in: #812 (comment) Before this change the location was always being reported as `(stdin):1:1` because the `SourcedException` kept getting modified with a broader source location in the `Note` branch of `loadWith`. This was originally done so that alternative imports would show the entire source span, but it mistakenly just kept bubbling up regardless of whether or not there were alternative imports. Instead, this includes an approximate source span for alternative imports. The source span bounds are correct but the contents just show which imports were alternated, even if they might have been buried in a larger expression. For example, if the original expression had been: ```haskell Some ./x ? None ./y ``` ... then the source span for the error message would display just: ```haskell ./x ? ./y ``` ... which is probably as good as it will get for now.
.. as caught by @Profpatsch in: #812 (comment) Before this change the location was always being reported as `(stdin):1:1` because the `SourcedException` kept getting modified with a broader source location in the `Note` branch of `loadWith`. This was originally done so that alternative imports would show the entire source span, but it mistakenly just kept bubbling up regardless of whether or not there were alternative imports. Instead, this includes an approximate source span for alternative imports. The source span bounds are correct but the contents just show which imports were alternated, even if they might have been buried in a larger expression. For example, if the original expression had been: ```haskell Some ./x ? None ./y ``` ... then the source span for the error message would display just: ```haskell ./x ? ./y ``` ... which is probably as good as it will get for now.
Related to #561
This adds source position information to missing imports
Before:
After: