Skip to content

bogus complaint when checking Callable arguments #18689

Open
@MarcelloPerathoner

Description

@MarcelloPerathoner

Bug Report

mypy complains about correct code. it confuses the arguments to a Callable parameter with the return value of the function.

To Reproduce

https://gist.github.com/mypy-play/59b8705d6737e1f8f4855d7b2270e7e9

Expected Behavior

Code checks OK.

Actual Behavior

Bogus error:
Argument 1 to "test" has incompatible type "Callable[[str], bool]"; expected "Callable[[float | str], bool]" [arg-type]

Your Environment

mypy 1.15.0 (compiled: yes)
Python 3.13.2

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions