Skip to content

No error for identical overloaded functions #1879

Closed
@shreydesai

Description

@shreydesai

Mypy doesn't raise any errors for this set up:

from typing import overload

class AbstractClass(object):
    @overload
    def f(self) -> None:
        pass

    @overload
    def f(self) -> None:
        pass

By definition, overloaded methods follow the "same name, different parameters" mantra, so allowing two identical overloaded methods should not be allowed.

This could get ugly when a base class inherits from the abstract class; there would be no guarantee the right function would be called.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions