Skip to content

Commit c5b4ccd

Browse files
committed
Improve interaction between --local-partial-types and hashability
1 parent 84e8f1f commit c5b4ccd

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test-data/unit/check-protocols.test

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2939,7 +2939,25 @@ class Gleemer:
29392939

29402940

29412941
[case testPartialTypeProtocolHashable]
2942-
# flags: --no-strict-optional
2942+
# flags: --no-strict-optional --no-local-partial-types
2943+
from typing import Protocol
2944+
2945+
class Hashable(Protocol):
2946+
def __hash__(self) -> int: ...
2947+
2948+
class ObjectHashable:
2949+
def __hash__(self) -> int: ...
2950+
2951+
class DataArray(ObjectHashable):
2952+
__hash__ = None
2953+
2954+
def f(self, x: Hashable) -> None:
2955+
reveal_type([self, x]) # N: Revealed type is "builtins.list[builtins.object]"
2956+
[builtins fixtures/tuple.pyi]
2957+
2958+
2959+
[case testPartialTypeProtocolHashableLocalPartialTypes]
2960+
# flags: --no-strict-optional --local-partial-types
29432961
from typing import Protocol
29442962

29452963
class Hashable(Protocol):

0 commit comments

Comments
 (0)