Improve error messages involving skolem variables #2102
Labels
C-Moderate Effort
Should take a moderate amount of time to address.
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-User Experience
This issue seeks to make the game more enjoyable to play.
There are two kinds of error messages we could get involving skolem variables.
We can simply get a type mismatch when we try to unify a skolem variable with something else. However, the current error is confusing since it references a made-up variable. For example:
It would be better if the error said something about polymorphism and mentioned the type variable
a
. This might require keeping track of a mapping between generated skolem variables and type variables in the polymorphic type.When a skolem variable escapes, the error message is even worse since the error explicitly mentions the word "skolem":
This case is more obscure and probably won't happen very much (especially once we fix Strange type checking error "Skolem variable would escape its scope" #2101), but it would still be nice to come up with a better error message that at least hints at what the problem might be.
The text was updated successfully, but these errors were encountered: