Skip to content

Specifics of callables sometimes lost in error messages #3581

@JukkaL

Description

@JukkaL

The name of of the callable argument and the fact that it has a default value are not displayed
in the second error message generated when type checking this example:

from typing import Callable, List
from mypy_extensions import Arg

a: List[Callable[[Arg(int, 'x')], None]]
reveal_type(a)  # Revealed type is 'builtins.list[def (x: builtins.int =)]'
a.x  # List[Callable[[int], None]] has no attribute "x"    <== Only "int"

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions