Ampersand icon indicating copy to clipboard operation
Ampersand copied to clipboard

Request for improvement of typechecker errors

Open RieksJ opened this issue 4 years ago • 2 comments

Consider the following script:

RELATION r[A*B]
--RELATION s[B*C]
RELATION t[X*Y]
RELATION u[Y*A]
RULE "test": I[A] |- r;s;V \/ V;t;u

This produces the following type-checker error:

  Cannot disambiguate: V
    Please add a signature (e.g. [A*B]) to it.
  Note: Some cases are not disambiguated fully by design. You can read about
    this at https://github.com/AmpersandTarski/Ampersand/issues/980#issuecomment-508985676 

Note that this error is caused by relation s not being defined (it was commented out to show this).

I've often noted that the cause of a disambiguation error is not that the types of relations are wrong, but that a relation isn't defined. It would be helpful if the typechecker would first check whether or not the relations in the expression are actually defined (throwing an error if that's not the case) before making an attempt to check their types. @sjcjoosten : is that feasible?

RieksJ avatar Feb 16 '21 12:02 RieksJ