-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update statement checker to use new diagnostics (#621)
Closes #540
- Loading branch information
Showing
10 changed files
with
137 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
Guppy compilation failed. Error in file $FILE:20 | ||
Error: Unsupported (at $FILE:20:4) | ||
| | ||
18 | @guppy(module) | ||
19 | def bar() -> None: | ||
20 | foo().x += 1 | ||
| ^^^^^ Assigning to this expression is not supported | ||
|
||
18: @guppy(module) | ||
19: def bar() -> None: | ||
20: foo().x += 1 | ||
^^^^^ | ||
GuppyError: Assigning to this expression is not supported yet. Consider binding the expression to variable and mutate that variable instead. | ||
Help: Consider assigning this value to a local variable first before assigning | ||
the field `x` | ||
|
||
Guppy compilation failed due to 1 previous error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
Guppy compilation failed. Error in file $FILE:15 | ||
Error: Attribute not found (at $FILE:15:6) | ||
| | ||
13 | @guppy(module) | ||
14 | def foo(s: MyStruct) -> None: | ||
15 | s.z = 2 | ||
| ^ `MyStruct` has no attribute `z` | ||
|
||
13: @guppy(module) | ||
14: def foo(s: MyStruct) -> None: | ||
15: s.z = 2 | ||
^^^ | ||
GuppyTypeError: Expression of type `MyStruct` has no attribute `z` | ||
Guppy compilation failed due to 1 previous error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
Guppy compilation failed. Error in file $FILE:15 | ||
Error: Type mismatch (at $FILE:15:6) | ||
| | ||
13 | @guppy(module) | ||
14 | def foo(s: MyStruct) -> None: | ||
15 | s.x = (1, 2) | ||
| ^ Cannot assign expression of type `(int, int)` to field `x` | ||
| of type `int` | ||
|
||
13: @guppy(module) | ||
14: def foo(s: MyStruct) -> None: | ||
15: s.x = (1, 2) | ||
^^^ | ||
GuppyTypeError: Cannot assign expression of type `(int, int)` to field with type `int` | ||
Guppy compilation failed due to 1 previous error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
Guppy compilation failed. Error in file $FILE:15 | ||
Error: Type mismatch (at $FILE:15:6) | ||
| | ||
13 | @guppy(module) | ||
14 | def foo(s: MyStruct) -> None: | ||
15 | s.x, a = (1, 2), 3 | ||
| ^ Cannot assign expression of type `(int, int)` to field `x` | ||
| of type `int` | ||
|
||
13: @guppy(module) | ||
14: def foo(s: MyStruct) -> None: | ||
15: s.x, a = (1, 2), 3 | ||
^^^ | ||
GuppyTypeError: Cannot assign expression of type `(int, int)` to field with type `int` | ||
Guppy compilation failed due to 1 previous error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
Guppy compilation failed. Error in file $FILE:18 | ||
Error: Unsupported (at $FILE:18:6) | ||
| | ||
16 | def foo(s: MyStruct) -> tuple[MyStruct, bool]: | ||
17 | t = s | ||
18 | t.x += 1 | ||
| ^ Mutation of classical fields is not supported | ||
|
||
16: def foo(s: MyStruct) -> tuple[MyStruct, bool]: | ||
17: t = s | ||
18: t.x += 1 | ||
^^^ | ||
GuppyError: Mutation of classical fields is not supported yet | ||
Guppy compilation failed due to 1 previous error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
Guppy compilation failed. Error in file $FILE:6 | ||
Error: Too many values to unpack (at $FILE:6:10) | ||
| | ||
4 | @compile_guppy | ||
5 | def foo() -> int: | ||
6 | a, b, c = 1, True | ||
| ^ Unexpected assignment target (expected 2, got 3) | ||
|
||
4: @compile_guppy | ||
5: def foo() -> int: | ||
6: a, b, c = 1, True | ||
^^^^^^^^^^^^^^^^^ | ||
GuppyTypeError: Not enough values to unpack (expected 3, got 2) | ||
Guppy compilation failed due to 1 previous error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
Guppy compilation failed. Error in file $FILE:6 | ||
Error: Not enough values to unpack (at $FILE:6:4) | ||
| | ||
4 | @compile_guppy | ||
5 | def foo() -> int: | ||
6 | a, b = 1, True, 3.0 | ||
| ^^^^ Not enough assignment targets (expected 3, got 2) | ||
|
||
4: @compile_guppy | ||
5: def foo() -> int: | ||
6: a, b = 1, True, 3.0 | ||
^^^^^^^^^^^^^^^^^^^ | ||
GuppyTypeError: Too many values to unpack (expected 2, got 3) | ||
Guppy compilation failed due to 1 previous error |