[red-knot] Assignability of class literals to Callables (#17704)
## Summary Subtyping was already modeled, but assignability also needs an explicit branch. Removes 921 ecosystem false positives. ## Test Plan New Markdown tests.
This commit is contained in:
@@ -529,6 +529,18 @@ c: Callable[[Any], str] = A().f
|
||||
c: Callable[[Any], str] = A().g
|
||||
```
|
||||
|
||||
### Class literal types
|
||||
|
||||
```py
|
||||
from typing import Any, Callable
|
||||
|
||||
c: Callable[[str], Any] = str
|
||||
c: Callable[[str], Any] = int
|
||||
|
||||
# error: [invalid-assignment]
|
||||
c: Callable[[str], Any] = object
|
||||
```
|
||||
|
||||
### Overloads
|
||||
|
||||
`overloaded.pyi`:
|
||||
|
||||
Reference in New Issue
Block a user