poor error message involving tuples and type conversion error #44

Closed
opened 2021-10-03 16:57:20 +08:00 by sb10q · 3 comments
Owner
@extern
def output_int(x: int32):
    ...

def run() -> int32:
    a = (1, True)
    output_int(int32(a[1]))
    return 0

results in:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Cannot unify variable 8 with bool due to incompatible value range at line 7 column 16"', nac3standalone/src/main.rs:65:35

Two problems here:

  1. int32(bool) is valid and should be supported. #60
  2. the reference to "variable 8" in the error does not mean anything to the user.
```python @extern def output_int(x: int32): ... def run() -> int32: a = (1, True) output_int(int32(a[1])) return 0 ``` results in: ``` thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Cannot unify variable 8 with bool due to incompatible value range at line 7 column 16"', nac3standalone/src/main.rs:65:35 ``` Two problems here: 1. <s>int32(bool) is valid and should be supported.</s> https://git.m-labs.hk/M-Labs/nac3/issues/60 2. the reference to "variable 8" in the error does not mean anything to the user.
Contributor

Can we split this into two issues? The 1st one is simple but the second one is very complicated.

Can we split this into two issues? The 1st one is simple but the second one is very complicated.
sb10q changed title from poor error message, int32(bool) should be supported to poor error message involving tuples and type conversion error 2021-10-10 11:08:29 +08:00
Author
Owner

Done

Done
sb10q closed this issue 2022-02-22 15:04:48 +08:00
Author
Owner
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Incorrect argument type for n. Expected N, but got str at src/classes.py: line 7 column 21\n\nNotes:\n    N ∈ {int32, int64, float, bool}"', nac3standalone/src/main.rs:223:35
``` thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Incorrect argument type for n. Expected N, but got str at src/classes.py: line 7 column 21\n\nNotes:\n N ∈ {int32, int64, float, bool}"', nac3standalone/src/main.rs:223:35 ```
Sign in to join this conversation.
No Milestone
No Assignees
2 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#44
No description provided.