-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
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 #11919
- Loading branch information
1 parent
9ea6d92
commit 48d810d
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