Skip to content

dataclasses.asdict() should accept dataclasses #314

Open
@grievejia

Description

@grievejia

Describe the Bug

Minimal repro:

import dataclasses

@dataclasses.dataclass
class Foo:
    x: int  = 0

def test(foo: Foo) -> None:
    dataclasses.asdict(foo)

Expected: no error
Actual: Argument Foo is not assignable to parameter obj with type DataclassInstance in function dataclasses.asdict

Sandbox Link

https://pyrefly.org/sandbox/?code=JYWwDg9gTgLgBAEwIYyQYwDZIM7YKbYBQhAAsqpjvtgHTnpa6GW5wBiEEAXIXH3AA8ucYADt4cALxwADMQR4AZnBgEYACkWdhHCAEo4AWgB8cAHIRReHv0QoGVAjRwJgaDVv1A

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    UserBugs reported by external users that should be prioritisedgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions