-
Notifications
You must be signed in to change notification settings - Fork 820
Improve error reporting: when type mismatch error involves a tuple, say it is a tuple #11234
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
Comments
@isaacabraham wanna add this to your list? |
A bit of a sidetrack, but what I find distracting at first glance are the apostrophes that enclose the type itself but also precede generic type parameters. Would it perhaps be possible to get rid of the former since the type is sitting on a line by itself? |
It's possible, but also an annoyingly huge change to make. Many baseline files and strings of expected error messages where |
Well, I was thinking in cases like this where the type signature is clearly separated from neighboring text, there'd be no need to visually escape it with extra characters. |
@cartermp 's example is actually an even worse error message in my test: Error FS0001 This expression was expected to have type Adding the word tuple when there is a tuple will be a good change regardless, although I find the asterisk a speed bump in and of itself. And I agree that removing the outer single quotes on the type would be super helpful. This example is a mess. |
This is a systematic problem in our output of types, there are maybe 200+ error messages or more in FSComp.txt where we quote types with single quotes I'd be happy to go through and modify all of them systematically if we have a policy. Using |
Perhaps
There is a core routine that displays the "minimal strings necessary to make it apparent that two types are different" ( Other examples might give
and so on. There is also a systematic addition of "context" for messages done by @forki which has greatly improved things Note there's a risk that eliding information will mean people don't get the information they need to understand what's going on. But I think in the IDEs they get that information elsewhere nowadays. Everytime we've improved these core routines by eliding unnecessary information we've not regretted it |
Consider the following error message:
This can arise in code like this:
I got some feedback from a newcomer that this was confusing for several reasons:
*
meant in the error messageThe first confusion could potentially be made better by a code fixer.
The second one would need a better error message. I propose the following:
This could still be confusing, but at least it's explicitly saying that it's a tuple type.
The text was updated successfully, but these errors were encountered: