-
Notifications
You must be signed in to change notification settings - Fork 216
Closed
Labels
bugSomething isn't workingSomething isn't workingnarrowingrelated to flow-sensitive type narrowingrelated to flow-sensitive type narrowingtyping semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc
Milestone
Description
In this snippet all reveal_type should reveal int; currently all but the first reveal object.
from typing import TypeIs
def is_int(val: object) -> TypeIs[int]:
return isinstance(val, int)
class A:
def is_int(self, val: object) -> TypeIs[int]:
return isinstance(val, int)
@classmethod
def is_int2(cls, val: object) -> TypeIs[int]:
return isinstance(val, int)
def _(x: object):
if is_int(x):
reveal_type(x)
if A().is_int(x):
reveal_type(x)
if A().is_int2(x):
reveal_type(x)
if A.is_int2(x):
reveal_type(x)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingnarrowingrelated to flow-sensitive type narrowingrelated to flow-sensitive type narrowingtyping semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc