-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
PR#7315: refine some error locations #736
Conversation
Ah, I was also working on it. trunk...alainfrisch:better_loc_unbound_constructor I'd propose to change the interface of # type exn += X = Y;;
Characters 12-17:
type exn += X = Y;;
^^^^^
Error: Unbound constructor Y |
That sounds like a good idea. Feel free to integrate my tests, add some, and send a pull-request with your implementation. |
I'm not sure I'll have time to finalize that quickly, so it's perhaps better to merge this PR and keep the API change in mind for later. Do you think the two failing tests are related to this PR?
|
45e06c0
to
2bebeb8
Compare
Yes, the tests were related to changed location information. I fixed the tests and integrated your own changes to extension redefinitions (plus lookup of the extensible type's name). I'll wait to leave some opportunity for review, then merge in trunk. Thanks for the advice! |
@@ -9,12 +9,12 @@ Error: This pattern matches values of type [? `A | `B ] | |||
|}];; | |||
let f x = ignore (match x with #ab -> 1); ignore (x : [`A]);; | |||
[%%expect{| | |||
Line _, characters 31-34: | |||
Line _, characters 32-34: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One could argue that the pattern here is #ab
, not ab
, so the old location might be better.
2bebeb8
to
b39f666
Compare
b39f666
to
0cc96fb
Compare
let f (x: #M.foo) = 0;; | ||
^^^^^^ | ||
^^^^^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: it's not possible to refine the location here to M
only without adding more location information inside Longident.t
, which would result in a painful change to the interface used by everyone manipulating the parsetree -- not a good idea.
The original behavior: # type foo = (unit,unit,unit,unit) bar;; Error: Unbound type constructor bar # type foo = unit bar;; Error: Unbound type constructor bar The new behavior: # type foo = (unit,unit,unit,unit) bar;; Error: Unbound type constructor bar # type foo = unit bar;; Error: Unbound type constructor bar It is not a big thing, but nevertheless a strict improvement, in my opinion. |
Co-authored-by: Jonah Beckford <9566106-jonahbeckford@users.noreply.gitlab.com>
Fixes MPR#7315 and some related imprecise messages -- I suspect that more remain, and started building a testsuite.