Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ reveal_type(Identity[0]) # revealed: str
## Class getitem union

```py
flag = True
def bool_instance() -> bool:
return True

class UnionClassGetItem:
if flag:
if bool_instance():

def __class_getitem__(cls, item: int) -> str:
return item
Expand Down Expand Up @@ -59,9 +60,10 @@ reveal_type(x[0]) # revealed: str | int
## Class getitem with unbound method union

```py
flag = True
def bool_instance() -> bool:
return True

if flag:
if bool_instance():
class Spam:
def __class_getitem__(self, x: int) -> str:
return "foo"
Expand All @@ -77,9 +79,10 @@ reveal_type(Spam[42])
## TODO: Class getitem non-class union

```py
flag = True
def bool_instance() -> bool:
return True

if flag:
if bool_instance():
class Eggs:
def __class_getitem__(self, x: int) -> str:
return "foo"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ reveal_type(Identity()[0]) # revealed: int
## Getitem union

```py
flag = True
def bool_instance() -> bool:
return True

class Identity:
if flag:
if bool_instance():

def __getitem__(self, index: int) -> int:
return index
Expand Down