Only allow matching on polymorphic arguments if they have been refined
to something concrete due to some other argument by the time they're
elaborated.
Any term which is not matchable, i.e. a function application or a
repeated variable on the left hand side, is automatically put in a
PHidden. The effect of elaborating PHidden t is to:
1. Delay the elaboration of 't' to the end of elaboration
2. When elaborating t, ensure that its value is already known due to
solving some other unification problem.
If something is PHidden, but not solvable by unification, elaboration
fails.
This finally fixes#323, and probably several other things.
This allows semantic annotations for errors. Potential features include
clicking source locations to jump to them, and showing "specifically"
sections collapsed at first.
This should make errors more readable, i.e. instead of printing:
Can't unify <SOME_LONG_TYPE> with <SOME_OTHER_VERY_LONG_TYPE>
this change makes it print
Can't unify
<SOME_LONG_TYPE>
with
<SOME_OTHER_LONG_TYPE>
and similarly for other errors.
That is, say what part of what is being elaborated at the time. Still todo,
better rendering of generated names like decorated names in where blocks,
generated function types in classes and instances etc.
Some error messages are now colourised as well. We assume that all unbound
names are implicit arguments, as the error message doesn't have sufficient
context otherwise.
If f x = g y fails to unify due to f and g failing to unify, record the
whole application as failed, otherwise we might accidentally unify x
and y.
Fixes#409