basedpyright
basedpyright copied to clipboard
`reportUnknownArgumentType` false negative in `__init__` statements
Code sample in basedpyright playground
class AnyOrUnknown:
def __init__(self, value):
print(value) # no error
def foo(self, value):
print(value) # error: reportUnknownArgumentType
this seems to be because pyright creates a fake typevar for constructor arguments, no idea why
class Bar:
asdf: int = 1
class Foo:
def __init__(self, value):
self.value = value
reveal_type(Foo(Bar()).value) # Bar
introduced in d29087520b652ed9368fa84c04cf3b107ed99b93