-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
infer_ty(IntVar)
should not print as _
in user error messages
#24770
Comments
(it might also be interesting to try to just write |
also, from #14007 i infer that we used to do better here ? Was it a deliberate choice to stop printing |
ah, seems like it was a deliberate choice, based on the argument presented here by @nikomatsakis But I think that the code in this ticket's description is a strong counter-example to that claim: the failure to unify |
Some thoughts:
|
Another option i just thought of while brainstorming is to print (Likewise, we would print |
I think we should use "integer type" and "floating-point type" instead of "integral variable" and "floating-point variable". |
I think this can be closed.
|
spawned off of #24728 (comment)
In an example like:
which yields the error message:
i find it frustrating that the first line prints the integral type variable as just
_
.It is not a completely unconstrained type; it must be some kind of integer.
(It is true that one should be able to figure this out from the third line. But I think we can still do better on the first line itself.)
I am thinking something like this could suffice:
Another slightly more verbose option (but less prone to misinterpretation when e.g. unsigned integers are involved, or when the user has defined a type named
iN
) would be:Yet another option, which is both succinct but will not collide with user definitions (at least not today):
and likewise one would imagine for the
FloatVar
caseI forced the
int?
andfloat?
to be on the left-hand side to ensure that they did not get mistaken for a question mark ending the error message itself. (I did consider?int
and?float
but I worry a little that those would get confused with the generalization marker?Sized
... maybe that is a small price to pay...)The text was updated successfully, but these errors were encountered: