Use more descriptive English terms in type error messages #1313
Labels
C-Low Hanging Fruit
Ideal issue for new contributors.
L-Error reporting
Reporting language or runtime errors to the player.
L-Type inference
The process of inferring the type of a Swarm expression.
S-Nice to have
The bug fix or feature would be nice but doesn't currently have much negative impact.
Z-Feature
A new feature to be added to the game.
This is a follow-up to #1308.
We should try harder to use more descriptive English terms in error messages, especially where unification variables or skolem variables occur in types. For example, instead of saying "expecting xyz to have type u3 -> u4 but it actually..." we could say something like "expecting xyz to be a function but it actually..." In other words, when printing type error messages, we should do some work to analyze the types involved and see if we can describe them in some way that doesn't involve a bunch of type variables, rather than simply pretty-printing them. At the very least we could replace unification variables with underscores or ellipses, as in "expecting xyz to have a type like
(_ -> _) * _
, but ..."So, concretely, I propose the following. In the context of
expecting xyz to ...
have type `int -> text`
be a function
have a type like `(_ -> _) * _`
The text was updated successfully, but these errors were encountered: