Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upImprove error message for non-matching types #3399
Comments
This comment has been minimized.
This comment has been minimized.
i-am-the-slime
commented
Jul 10, 2018
|
I think it could be even nicer if the compiler could insert a little (?helpme (thingOfTheWrongType)) and suggest possible fixes but that's most probably out of scope. |
This comment has been minimized.
This comment has been minimized.
|
We've had issues about this previously, and did attempt to change the error to work this way... but unfortunately the type checker isn't able to know for sure whether A or B is the type that is actually desired. |
This comment has been minimized.
This comment has been minimized.
|
Yeah, I’m certain there is already an issue for exactly this, possibly even open. |
This comment has been minimized.
This comment has been minimized.
i-am-the-slime
commented
Jul 12, 2018
|
I see. Sorry guys! |
i-am-the-slime
closed this
Jul 12, 2018
This comment has been minimized.
This comment has been minimized.
i-am-the-slime
commented
Jul 12, 2018
|
Actually maybe we could make that explicit in the message? I remember trying to find the order by making some minimal example. Since there is no order this could be misleading. I know there is nothing in the message suggests that there is an order but still. The message could have a little "in no particular order" disclaimer. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Actually sorry, I take back what I said before: while we do have discussion which notes that identifying expected vs actual types would be useful, there doesn’t appear to be an open issue for actually doing so. |
This comment has been minimized.
This comment has been minimized.
|
So we might want to reopen this perhaps? |
JordanMartinez
referenced this issue
Nov 21, 2018
Closed
Explain that type errors can't always determine expected/actual type difference #150
This comment has been minimized.
This comment has been minimized.
|
I think this should be reopened. At the very least, it would track that the issue does exist. |
i-am-the-slime commentedJul 10, 2018
I never know what the compiler wants from me when it says:
Could not match type A with type BWhich one does it expect? Which one is the one I supply?
For people like me it's not always obvious which type I am supplying.
I don't really see any downside to changing this to:
Could not match expected type A with actual type BI don't know about any tooling that might depend on this exact message.