JetBrains / JetBrains/Arend

Unnamed variables in error messages

Open
#269 3 comments 0 reactions 0 assignees View on GitHub
pretty-printer
Dominant language
Java
Stars
756
Forks
31
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue using the foo and bar example in the report and inspect the error-rendering path for unnamed variables. Done means the diagnostic distinguishes the unnamed variable, for example by displaying `_unnamed`, without creating a name clash.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.