-
Notifications
You must be signed in to change notification settings - Fork 280
Labels
Description
Describe the Bug
Reproducer:
import atexit
from typing import overload
@overload
def f(x: int) -> None: ...
@overload
def f(x: str, message: str) -> None: ...
def f(x, message=None): ...
atexit.register(f, "foo")
Output:
ERROR Argument `Literal['foo']` is not assignable to parameter `x` with type `int` in function `atexit.register` [bad-argument-type]
--> /tmp/foo.py:12:20
|
12 | atexit.register(f, "foo")
It looks like Pyrefly selects the overload too early, before it inspects the arguments passed to atexit.register.
I think the answer to #2355 is "yes" :)
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
No response
Reactions are currently unavailable