Skip to content

overloads without implementations (in stub files) are not detected #116

Description

@tlambert03

Describe the bug
Methods and functions that are decorated with @overload but do not have an implementation (as is standard in a stub file) are not detected:

To Reproduce

# mystub.pyifromtypingimportoverloadclassM:
@overloaddeff(self, x: int) ->int: ...
@overloaddeff(self, x: str) ->str: ...
classM2:
@overloaddeff(self, x: int) ->int: ...
@overloaddeff(self, x: str) ->str: ...
deff(self, x: str|int) ->str|int: ... # one wouldn't normally do this in a stub
In [3]: griffe.load('mystub._test.M').membersOut[3]: {}
In [4]: griffe.load('mystub._test.M2').membersOut[4]: {'f': <Function('f', 14, 14)>}

Expected behavior
Expected f method to be detected.

System (please complete the following information):

  • griffe version: 0.24.1
  • Python version: 3.10
  • OS: mac

Will probably be relevant for mkdocstrings/mkdocstrings#308 as well

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions