Skip to content

Confusing error message when using AnyStr #963

Open
@oconnor663

Description

@oconnor663
from typing import AnyStr

def f(x: AnyStr, y: AnyStr) -> AnyStr:
    print(x + y)

f('one', b'two')

This correctly fails to typecheck because the second arg is bytes, but the error message is hard to follow:

test.py:6: error: Type argument 1 of "f" has incompatible value "object"

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions