improve type annotation error message #87

Closed
opened 2021-11-10 16:46:56 +08:00 by sb10q · 3 comments
Owner

Currently any problem with a type annotation results in

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "name cannot be parsed as a type annotation"', nac3artiq/src/lib.rs:378:44

There should at least be an indication about where the problematic type annotation is.

Currently any problem with a type annotation results in ``` thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "name cannot be parsed as a type annotation"', nac3artiq/src/lib.rs:378:44 ``` There should at least be an indication about where the problematic type annotation is.
sb10q referenced this issue from a commit 2021-12-22 08:52:20 +08:00
sb10q closed this issue 2021-12-22 08:54:01 +08:00
Author
Owner
class A:
    c: bogustype

Prints the confusing message:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "name cannot be parsed as a type annotation at line 13 column 8"', nac3standalone/src/main.rs:224:35

The parsing is actually fine - the error is the identifier does not exist.
Can we do better and print more fine-grained errors?

```python class A: c: bogustype ``` Prints the confusing message: ``` thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "name cannot be parsed as a type annotation at line 13 column 8"', nac3standalone/src/main.rs:224:35 ``` The parsing is actually fine - the error is the identifier does not exist. Can we do better and print more fine-grained errors?
sb10q reopened this issue 2021-12-22 17:56:01 +08:00
ychenfo referenced this issue from a commit 2021-12-27 16:57:43 +08:00
Author
Owner

Would be better if it gave the nature of the error instead of "not a valid type annotation" for anything that goes wrong...

Would be better if it gave the nature of the error instead of "not a valid type annotation" for anything that goes wrong...
sb10q closed this issue 2022-02-22 16:03:10 +08:00
Author
Owner
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "`bogustype` is not a valid type annotation (at src/classes.py: line 6 column 8)"', nac3standalone/src/main.rs:223:35
``` thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "`bogustype` is not a valid type annotation (at src/classes.py: line 6 column 8)"', nac3standalone/src/main.rs:223:35 ```
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#87
No description provided.