Skip to content

fix callable enum narrowing - #21946

Open
EmmanuelNiyonshuti wants to merge 1 commit into
python:masterfrom
EmmanuelNiyonshuti:callable-enums
Open

fix callable enum narrowing#21946
EmmanuelNiyonshuti wants to merge 1 commit into
python:masterfrom
EmmanuelNiyonshuti:callable-enums

Conversation

@EmmanuelNiyonshuti

Copy link
Copy Markdown
Contributor

Fixes ##17222

Narrowing an enum to a literal(with ``==ormatch`) gives a `LiteralType`, which was not being checked when type checking a call. This PR add a `LiteralType` branch to `check_call` that will delegate to its `fallback` instance.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

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

scipy (https://github.com/scipy/scipy)
- scipy/conftest.py:678: error: "Literal['skip']" not callable  [misc]
+ scipy/conftest.py:678: error: "str" not callable  [operator]
- scipy/conftest.py:678: error: "Literal['xfail']" not callable  [misc]

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.

1 participant