Skip to content

Conversation

@cdce8p
Copy link
Collaborator

@cdce8p cdce8p commented Nov 2, 2025

The error hint for Need type annotations for ... should defer to options.use_union_syntax when evaluating if Union or | should be used. This will also make it easier to eventually upgrade all tests to use the PEP 604 syntax.

Comment on lines -143 to 144
if "union-error" not in testcase.file:
if "union-error" not in testcase.file and "Pep604" not in testcase.name:
options.force_union_syntax = True
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Special case for testSuggestPep604AnnotationForPartialNone. This will be removed once all tests are updated to just use the the PEP 604 syntax.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 2, 2025

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@cdce8p cdce8p requested a review from hauntsaninja November 2, 2025 19:27
@JukkaL JukkaL merged commit 5bdfe7e into python:master Nov 3, 2025
21 checks passed
@cdce8p cdce8p deleted the union-syntax branch November 3, 2025 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants