Arend icon indicating copy to clipboard operation
Arend copied to clipboard

Unnamed variables in error messages

Open valis opened this issue 4 years ago • 3 comments

An unnamed variable (i.e., _) can be given a name in an error message. For example, consider the following code:

\func foo {A : \Type} (B : A -> \Type) (f : \Pi (a : A) -> B a) => 0

\func bar {A : \Type} (a : A) (B : A -> \Type) (b : B a) => foo B (\lam _ => b)

It produces the following error, which is confusing because the first 'a' is actually '_'

[ERROR] test.ard:37:79: Type mismatch
  Expected type: B a
    Actual type: B a

It is better to choose a name which clearly indicates that the variable was unnamed, like '_unnamed'. It is also unlikely that such a name will cause a clash of names as in the example above.

valis avatar Oct 02 '20 19:10 valis

This is what I see: image

Is that because you've fixed it?

ice1000 avatar Oct 03 '20 01:10 ice1000

image

ice1000 avatar Oct 03 '20 01:10 ice1000

Fixed the code

valis avatar Oct 03 '20 12:10 valis