pylint
pylint copied to clipboard
`E1120:no-value-for-parameter` false positive when subclass has `field` property
Bug description
import inspect
from dataclasses import dataclass, field
@dataclass
class Foo:
a: int
b: str
@dataclass
class Bar(Foo):
a: int = field(init=False, default=1)
c: str
a = Bar(b="", c="") # error: No value for argument 'a' in constructor call (E1120:no-value-for-parameter)
print(inspect.signature(Bar.__init__)) # (self, b: str, c: str) -> None
print(a) # Bar(a=1, b='', c='')
Configuration
No response
Command used
pylint asdf.py
Pylint output
************* Module asdf
asdf.py:17:4: E1120: No value for argument 'a' in constructor call (no-value-for-parameter)
Expected behavior
no error
Pylint version
pylint 2.14.5
astroid 2.11.7
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
OS / Environment
No response
Additional dependencies
No response