Created
May 9, 2024 00:44
-
-
Save mypy-play/e272e1c05d4170c4a2678e57782de202 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
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
from typing import Literal, override | |
class Foo: | |
@override | |
def __eq__(self, value: object, /) -> bool: | |
return True | |
def fun(a: Foo | Literal["a"]) -> None: | |
if a == "a": | |
reveal_type(a) # Foo | Literal['a'] | |
else: | |
reveal_type(a) # Foo | Literal['a'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment