-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugmypy got something wrongmypy got something wrongpriority-2-lowtopic-dataclassestopic-runtime-semanticsmypy doesn't model runtime semantics correctlymypy doesn't model runtime semantics correctly
Description
from dataclasses import dataclass
class Foo:
def __init__(self, value: int) -> None:
self.value = value # never gets run
@dataclass
class Bar(Foo):
value2: int
Bar(1).value # runtime error but no mypy error
not sure if this is supposed to be allowed but either way this fails at runtime, so mypy should warn about it:
AttributeError: 'Bar' object has no attribute 'value'. Did you mean: 'value2'?
DetachHead
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongpriority-2-lowtopic-dataclassestopic-runtime-semanticsmypy doesn't model runtime semantics correctlymypy doesn't model runtime semantics correctly