basedmypy
basedmypy copied to clipboard
`field` function used by `dataclass_transform` class doesn't work with default values if the argument is positional
Describe the problem, ie expected/actual result (if it's not blatantly obvious)
original issue: https://github.com/pydantic/pydantic/issues/9902 also raised on bpr: https://github.com/DetachHead/basedpyright/issues/536
since mypy is able to detect that the positional argument is for default, then i don't see a reason why it shouldn't apply the dataclass special casing to it
Gist to reproduce
from pydantic import Field
from pydantic.dataclasses import dataclass
@dataclass
class Foo:
a: int | None = Field(None)
b: int | None = Field(default=None)
foo = Foo() # error: Argument missing for parameter "a"
Basedmypy version
No response
Command-line flags
No response
Configuration options from pyproject.toml (and other config files)
No response
Python version used
No response
Operating system and version
No response