Open
Description
Same request as in python/mypy#19411 (comment), but just the "detect incorrect default" part, as the "missing default" part might not be a good idea after all
(as discussed on discord)
Example:
from typing import Literal, overload, reveal_type
@overload
def foo(a: Literal[True] = ...) -> None: ...
@overload
def foo(a: Literal[False]) -> int: ...
def foo(a: bool = False) -> None | int:
return 1 if not a else None
reveal_type(foo())
I'd like Pyrefly to flag that a: Literal[True] = ...
is incorrect, as the default (False
) has no overlap with Literal[True]