-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: Update statement checker to use new diagnostics #621
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 | ||
| ^ Attribute `z` not found on type `int` | ||
|
||
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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be an easier read if this error was:
or even better
I actually don't see the relevance of the inferred type here, the error message on the left is quite descriptive as is. Perhaps I am missing some context here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops yes it's supposed to say "MyStruct" instead of "int" 👍