-
Notifications
You must be signed in to change notification settings - Fork 302
Change the typing spec around string references #2144
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
Open
davidhalter
wants to merge
25
commits into
python:main
Choose a base branch
from
davidhalter:string-annotations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
7627175
Change the typing spec around string references
davidhalter d08c226
Improve the wording around string references in the spec
davidhalter 070312d
Remove error types
davidhalter 41fc20c
Update docs/spec/annotations.rst
davidhalter ea921e8
Merge remote-tracking branch 'origin/main' into string-annotations
davidhalter caa71f6
Wrap the test in a consistent way
davidhalter 0f56cb9
Small wording change
davidhalter cc4cec2
Ensure that forward annotations don't depend on the position in the s…
davidhalter 928464d
Merge remote-tracking branch 'origin/main' into string-annotations
davidhalter d6e0e87
Merge remote-tracking branch 'origin/main' into string-annotations
davidhalter 927aa61
Add notes for the forward reference changes
davidhalter 0f3a654
Update conformance/tests/annotations_forward_refs.py
davidhalter a687acd
Update conformance/tests/annotations_forward_refs.py
davidhalter 0d117ce
Update conformance/tests/annotations_forward_refs.py
davidhalter 813eaca
Merge remote-tracking branch 'origin/main' into string-annotations
davidhalter 6788f7d
Upgrade results
davidhalter 982907b
Add more cases for forward references
davidhalter 0742fae
Run the latest results
davidhalter 09a4088
Add notes for Zuban
davidhalter d4f53a0
Try to be more precise with forward reference notes
davidhalter 63bd33a
Add spec definition for: from __future__ import annotations
davidhalter 9b8862e
Update conformance/results/mypy/annotations_forward_refs.toml
davidhalter 09b59c9
Add forward references
davidhalter 18c5636
Latest changes from review
davidhalter fedc0e2
Test from __future__ annotations name resolution
davidhalter 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| conformance_automated = "Pass" | ||
| errors_diff = """ | ||
| """ | ||
| output = """ | ||
| """ |
This file contains hidden or 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
22 changes: 22 additions & 0 deletions
22
conformance/results/pycroscope/annotations_future_import.toml
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| conformant = "Partial" | ||
| notes = """ | ||
| Names in annotations that refer to definitions after them are not resolved in the precence of `from __future__ import annotations` | ||
| Nested classes are resolved, but its type is Any | ||
| """ | ||
| conformance_automated = "Fail" | ||
| errors_diff = """ | ||
| Line 26: Unexpected errors ['./annotations_future_import.py:26:12: Undefined name: ClassInner [undefined_name]'] | ||
| Line 27: Unexpected errors ['./annotations_future_import.py:27:12: Undefined name: ClassInner [undefined_name]'] | ||
| Line 42: Unexpected errors ['./annotations_future_import.py:42:16: Any[inference] is not equivalent to annotations_future_import.ClassB.ClassInner'] | ||
| Line 43: Unexpected errors ['./annotations_future_import.py:43:16: Any[inference] is not equivalent to annotations_future_import.ClassB.ClassInner'] | ||
| Line 44: Unexpected errors ['./annotations_future_import.py:44:16: Any[inference] is not equivalent to annotations_future_import.ClassB.ClassInner'] | ||
| Line 45: Unexpected errors ['./annotations_future_import.py:45:16: Any[inference] is not equivalent to annotations_future_import.ClassB.ClassInner'] | ||
| """ | ||
| output = """ | ||
| ./annotations_future_import.py:26:12: Undefined name: ClassInner [undefined_name] | ||
| ./annotations_future_import.py:27:12: Undefined name: ClassInner [undefined_name] | ||
| ./annotations_future_import.py:42:16: Any[inference] is not equivalent to annotations_future_import.ClassB.ClassInner | ||
| ./annotations_future_import.py:43:16: Any[inference] is not equivalent to annotations_future_import.ClassB.ClassInner | ||
| ./annotations_future_import.py:44:16: Any[inference] is not equivalent to annotations_future_import.ClassB.ClassInner | ||
| ./annotations_future_import.py:45:16: Any[inference] is not equivalent to annotations_future_import.ClassB.ClassInner | ||
| """ |
This file contains hidden or 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
17 changes: 17 additions & 0 deletions
17
conformance/results/pyrefly/annotations_future_import.toml
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| conformant = "Partial" | ||
| notes = """ | ||
| Names in annotations that refer to definitions after them are not resolved in the precence of `from __future__ import annotations` | ||
| """ | ||
| conformance_automated = "Fail" | ||
| errors_diff = """ | ||
| Line 26: Unexpected errors ['Could not find name `ClassInner` [unknown-name]'] | ||
| Line 27: Unexpected errors ['Could not find name `ClassInner` [unknown-name]'] | ||
| Line 42: Unexpected errors ['assert_type(Unknown, ClassB.ClassInner) failed [assert-type]'] | ||
| Line 43: Unexpected errors ['assert_type(Unknown, ClassB.ClassInner) failed [assert-type]'] | ||
| """ | ||
| output = """ | ||
| ERROR annotations_future_import.py:26:13-23: Could not find name `ClassInner` [unknown-name] | ||
| ERROR annotations_future_import.py:27:14-24: Could not find name `ClassInner` [unknown-name] | ||
| ERROR annotations_future_import.py:42:16-45: assert_type(Unknown, ClassB.ClassInner) failed [assert-type] | ||
| ERROR annotations_future_import.py:43:16-45: assert_type(Unknown, ClassB.ClassInner) failed [assert-type] | ||
| """ | ||
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| conformance_automated = "Pass" | ||
| errors_diff = """ | ||
| """ | ||
| output = """ | ||
| """ |
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.
Could we narrow this to “Forward references to nested classes are not resolved”? The recorded failures are for
ClassInner; the module-levelClassAandClassCforward references succeed, so the current wording overstates the limitation. I think the same wording change applies to pycroscope's corresponding note.