Open
Description
Bug Report
If a subclass __init__
passes **kwargs
to it's superclass, the superclasses parameter types should be used to validate the subclass arguments.
To Reproduce
Run mypy on this file:
import datetime
class Bar:
def __init__(self, a: int, b: str, c: datetime.datetime):
pass
class Baz(Bar):
def __init__(self, **kwargs):
super().__init__(**kwargs)
Baz(b=3)
Expected Behavior
Something like
error: Argument "b" to "Baz" has incompatible type "int"; expected "str"
Actual Behavior
mypy found no errors
Your Environment
- Mypy version used: mypy 0.800
- Mypy command-line flags: python filename
- Mypy configuration options from
mypy.ini
(and other config files): none - Python version used: 3.8.6
- Operating system and version: macOS 10.15.7