File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
crates/red_knot_python_semantic/resources/mdtest/subscript Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,11 @@ reveal_type(Identity[0]) # revealed: str
2121## Class getitem union
2222
2323``` py
24- flag = True
24+ def bool_instance () -> bool :
25+ return True
2526
2627class UnionClassGetItem :
27- if flag :
28+ if bool_instance() :
2829
2930 def __class_getitem__ (cls , item : int ) -> str :
3031 return item
@@ -59,9 +60,10 @@ reveal_type(x[0]) # revealed: str | int
5960## Class getitem with unbound method union
6061
6162``` py
62- flag = True
63+ def bool_instance () -> bool :
64+ return True
6365
64- if flag :
66+ if bool_instance() :
6567 class Spam :
6668 def __class_getitem__ (self , x : int ) -> str :
6769 return " foo"
@@ -77,9 +79,10 @@ reveal_type(Spam[42])
7779## TODO: Class getitem non-class union
7880
7981``` py
80- flag = True
82+ def bool_instance () -> bool :
83+ return True
8184
82- if flag :
85+ if bool_instance() :
8386 class Eggs :
8487 def __class_getitem__ (self , x : int ) -> str :
8588 return " foo"
Original file line number Diff line number Diff line change @@ -30,10 +30,11 @@ reveal_type(Identity()[0]) # revealed: int
3030## Getitem union
3131
3232``` py
33- flag = True
33+ def bool_instance () -> bool :
34+ return True
3435
3536class Identity :
36- if flag :
37+ if bool_instance() :
3738
3839 def __getitem__ (self , index : int ) -> int :
3940 return index
You can’t perform that action at this time.
0 commit comments