Skip to content

Regression: false positive about overload item never being matched #16338

Closed
@JukkaL

Description

@JukkaL

This fragment generates a false positive, starting from #15913:

from typing import overload, Any

class C:
    @overload
    def f(self, e: str, **kwargs) -> str: ...
    @overload
    # error: Overloaded function signature 2 will never be matched: signature 1's
    #        parameter type(s) are the same or broader
    def f(self, *args, **kwargs) -> Any: ...
    def f(self, *args, **kwargs):
        pass

The signature of item 2 is wider than item 1 due to accepting an arbitrary number of positional arguments and with arbitrary types, so this is a false positive.

cc @ilevkivskyi

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions