Skip to content

Fix plugin invocation on classmethod calls through Type #7969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mypy/checkexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ def method_fullname(self, object_type: Type, method_name: str) -> Optional[str]:
# We "unwrap" it to a regular type, as the class/instance method difference doesn't
# affect the fully qualified name.
object_type = get_proper_type(object_type.ret_type)
elif isinstance(object_type, TypeType):
object_type = object_type.item

type_name = None
if isinstance(object_type, Instance):
Expand Down
13 changes: 12 additions & 1 deletion test-data/unit/fine-grained-suggest.test
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,11 @@ No guesses that match criteria!
() -> None
==

[case testSuggestInferClassMethod]
[case testSuggestClassMethod]
# flags: --strict-optional
# suggest: foo.F.bar
# suggest: foo.F.baz
# suggest: foo.F.eggs
[file foo.py]
class F:
@classmethod
Expand All @@ -698,6 +699,15 @@ class F:
def baz(x, y):
return x

@classmethod
def spam(cls):
# type: () -> None
cls.eggs(4)

@classmethod
def eggs(cls, x):
pass

[file bar.py]
from foo import F
def bar(iany) -> None:
Expand All @@ -709,6 +719,7 @@ def bar(iany) -> None:
[out]
(int, int) -> int
(str, int) -> str
(int) -> None
==

[case testSuggestColonBasic]
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy