Skip to content

LiteralString should not be compatible with str in an invariant context #16169

Closed as not planned
@erictraut

Description

@erictraut

Consider the following code sample.

from typing import LiteralString

def func1(a: list[LiteralString]):
    v1: list[str] = a   # Should generate a type error but does not currently

I just fixed a related bug in pyright.

Mypy version 1.5.1

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