forked from python/mypy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This fix allows using enum values in place of literals. For example: ``` def is_a(a: Literal["a"]): return None class MyStr(Enum): a = "a" b = "b" is_a(MyStr.a.value) ``` Currently this fails with ``` error: Argument 1 to "is_a" has incompatible type "str"; expected "Literal['a']" ``` The fix itself is simple - the special casing of final status for enums was being called too late to have an effect. Moving the function call up solves the problem. Fixes python#11919
- Loading branch information
1 parent
0c38b37
commit c0ba36a
Showing
3 changed files
with
34 additions
and
19 deletions.
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