-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed type evaluation behavior for accesses to attributes on a clas…
…s that derives from `Any`. Previously, these were evaluated as `Unknown`, but they are now evaluated as `Any`. This is related to #6136. (#6137) Co-authored-by: Eric Traut <erictr@microsoft.com>
- Loading branch information
1 parent
df62538
commit 2916bb2
Showing
5 changed files
with
38 additions
and
8 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
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
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
20 changes: 20 additions & 0 deletions
20
packages/pyright-internal/src/tests/samples/memberAccess24.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,20 @@ | ||
# This sample tests the case where an attribute is accessed from a | ||
# class that derives from an unknown type or Any. | ||
|
||
from typing import Any | ||
from dummy import UnknownX # type: ignore | ||
|
||
|
||
class DerivesFromUnknown(UnknownX): | ||
pass | ||
|
||
|
||
class DerivesFromAny(Any): | ||
pass | ||
|
||
|
||
v1 = DerivesFromUnknown().x | ||
reveal_type(v1, expected_text="Unknown") | ||
|
||
v2 = DerivesFromAny().x | ||
reveal_type(v2, expected_text="Any") |
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