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
Imprecise typing error location if discriminee of Ltac2 match!
/lazy_match!
is not a constr
#17477
Comments
match!
/lazy_match
is not a constr
match!
/lazy_match!
is not a constr
Presumably this is a more general problem of Ltac2 notations and error messages that arise in the inlined notation not having an inverse mapping that says what part of the shorthand is at fault? |
Probably we raise with a loc where the notation is defined, but since we don't allow error locs that aren't inside the current command it gets replaced with the more general loc. |
Actually this is technically true but not useful: we raise with the loc of
but that location isn't very user friendly. The typing process desugars the notation into
And even the annotation for Ltac2 Eval
(match! 'true with
| true => 'true
| false => 'false
end : bool). puts the error location on the whole command. I think ultimately we want most notations to be typed ahead of time, so TBH I'm not sure there's much use for untyped notations, the type system is restricted enough that interesting notations seem to only use their arguments monomorphically (ie can infer their types) and I'm not sure it's possible to use more than prenex polymorphism (because they get desugared to cc @JasonGross have you used ltac2 notations in a way that seems to require a delayed typechecking? |
I have not tried to do anything very tricky with Ltac2 notations. If I try to imagine uses for non-monomorphic notations, the thoughts I have are:
Ltac2 doesn't really have enough untyped primitive syntax to want untyped notations IMO. The untyped primitive syntax is just type ascription, assignment, field lookup, match? |
Not sure what you call untyped syntax but notations are globalized, so eg
No |
Can you write |
I don't think |
Ah, I guess it's just |
Hmm, would the situation be different if we had global mutable state a la #13982 (comment) ( |
The reported error position spans the whole function, starting at the
L
ofLtac2
, going all the way to the.
at the end.Desired behavior: Only the text between
match!
and thewith
should be reported in the error.The text was updated successfully, but these errors were encountered: