Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnamed variables in error messages #269

Open
valis opened this issue Oct 2, 2020 · 3 comments
Open

Unnamed variables in error messages #269

valis opened this issue Oct 2, 2020 · 3 comments

Comments

@valis
Copy link
Collaborator

valis commented Oct 2, 2020

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.

@ice1000
Copy link
Contributor

ice1000 commented Oct 3, 2020

This is what I see:
image

Is that because you've fixed it?

@ice1000
Copy link
Contributor

ice1000 commented Oct 3, 2020

image

@valis
Copy link
Collaborator Author

valis commented Oct 3, 2020

Fixed the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants