-
Notifications
You must be signed in to change notification settings - Fork 135
Closed
Labels
callsIssues relating to call-signature checking and diagnosticsIssues relating to call-signature checking and diagnostics
Milestone
Description
Description
Currently red knot assumes all calls to class literals are valid and create instances. E.g. this test yields no diagnostic currently
from typing import Literal
class Number:
def __init__(self, value: int):
self.value = 1
def __pos__(self) -> int:
return +self.value
def __neg__(self) -> int:
return -self.value
def __invert__(self) -> Literal[True]:
return True
a = Number()We should check __init__ signature just like any other call and emit diagnostics.
This is step 1 in a series of feature to support the instance creation process in full. The related logic of handling type[C] is tracked in astral-sh/ruff#15948
Metadata
Metadata
Assignees
Labels
callsIssues relating to call-signature checking and diagnosticsIssues relating to call-signature checking and diagnostics