-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a bug that resulted in a false positive when an expression of t…
…ype `type[Self]` was used as the base type for a member access expression that was then used to call an instance method on that class. This addresses #5530.
- Loading branch information
1 parent
5be5852
commit d6da783
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/pyright-internal/src/tests/samples/memberAccess22.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This sample tests the case where a `type[T]` or `type[Self]` typevar is | ||
# used as the base for a member access but is then used to call an | ||
# instance method on the resulting class. | ||
|
||
from contextlib import contextmanager | ||
|
||
|
||
class A: | ||
@classmethod | ||
def method1(cls) -> None: | ||
cls.method2 | ||
|
||
@contextmanager | ||
def method2(self): | ||
yield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters