Commit a378ff3 1 parent d8bca0d commit a378ff3 Copy full SHA for a378ff3
File tree 2 files changed +12
-8
lines changed
crates/red_knot_python_semantic/resources/mdtest/subscript
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
21
21
## Class getitem union
22
22
23
23
``` py
24
- flag = True
24
+ def bool_instance () -> bool :
25
+ return True
25
26
26
27
class UnionClassGetItem :
27
- if flag :
28
+ if bool_instance() :
28
29
29
30
def __class_getitem__ (cls , item : int ) -> str :
30
31
return item
@@ -59,9 +60,10 @@ reveal_type(x[0]) # revealed: str | int
59
60
## Class getitem with unbound method union
60
61
61
62
``` py
62
- flag = True
63
+ def bool_instance () -> bool :
64
+ return True
63
65
64
- if flag :
66
+ if bool_instance() :
65
67
class Spam :
66
68
def __class_getitem__ (self , x : int ) -> str :
67
69
return " foo"
@@ -77,9 +79,10 @@ reveal_type(Spam[42])
77
79
## TODO: Class getitem non-class union
78
80
79
81
``` py
80
- flag = True
82
+ def bool_instance () -> bool :
83
+ return True
81
84
82
- if flag :
85
+ if bool_instance() :
83
86
class Eggs :
84
87
def __class_getitem__ (self , x : int ) -> str :
85
88
return " foo"
Original file line number Diff line number Diff line change @@ -30,10 +30,11 @@ reveal_type(Identity()[0]) # revealed: int
30
30
## Getitem union
31
31
32
32
``` py
33
- flag = True
33
+ def bool_instance () -> bool :
34
+ return True
34
35
35
36
class Identity :
36
- if flag :
37
+ if bool_instance() :
37
38
38
39
def __getitem__ (self , index : int ) -> int :
39
40
return index
You can’t perform that action at this time.
0 commit comments