Skip to content

Conversation

@hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja commented Jan 17, 2026

Fixes some of the primer regressions from #20492

Fixes #19753

This should also happen to fix the case mentioned by cdce8p in #20492 (comment)

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

schemathesis (https://github.com/schemathesis/schemathesis)
- src/schemathesis/generation/coverage.py: note: In member "is_valid_for_location" of class "CoverageContext":
- src/schemathesis/generation/coverage.py:258: error: Statement is unreachable  [unreachable]
- src/schemathesis/generation/coverage.py: note: In member "leads_to_negative_test_case" of class "CoverageContext":
- src/schemathesis/generation/coverage.py:264: error: Statement is unreachable  [unreachable]
- src/schemathesis/generation/coverage.py: note: In member "will_be_serialized_to_string" of class "CoverageContext":
- src/schemathesis/generation/coverage.py:272: error: Right operand of "and" is never evaluated  [unreachable]
- src/schemathesis/generation/coverage.py: note: In function "_positive_string":
- src/schemathesis/generation/coverage.py:958: error: Statement is unreachable  [unreachable]
- src/schemathesis/generation/coverage.py: note: In function "_negative_format":
- src/schemathesis/generation/coverage.py:1496: error: Statement is unreachable  [unreachable]

if t.last_known_value:
result.update(ambiguous_enum_equality_keys(t.last_known_value))
elif t.type.is_enum and any(
base.fullname in ("enum.IntEnum", "enum.StrEnum", "builtins.str", "builtins.int")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is important line in the diff / review without whitespace changes

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.

Type narrowing an enum shouldn't narrow to a literal

1 participant