Skip to content

keyword unpack isn't checked for anything that's not dict #11144

Closed
@KotlinIsland

Description

@KotlinIsland

😳

from typing import Generic, TypeVar, Mapping
T = TypeVar("T")
T2 = TypeVar("T2")

class A(dict[T, T2]):
    ...

def foo(**i: float) -> None:
    ...

a: A[str, str]
d = {"a": "b"}

foo(**a)  # no error
foo(**d)  # error: Argument 1 to "foo" has incompatible type "**Dict[str, str]"; expected "float"

https://mypy-play.net/?mypy=latest&python=3.10&gist=1cbdc48546f3a1bc61476936c3dc9af7

Might be related to #11138

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions