@@ -7,173 +7,130 @@ const s: S = .{
7
7
.float = 1.2 ,
8
8
};
9
9
10
- pub fn main () ! void {
11
- var runtime_bool : bool = true ;
10
+ var runtime_bool : bool = true ;
12
11
13
- const widened_int_0 = if (runtime_bool ) @as (i8 , 0 ) else @as (i16 , 0 );
14
- _ = widened_int_0 ;
15
- // ^^^^^^^^^^^^^ (i16)()
12
+ const widened_int_0 = if (runtime_bool ) @as (i8 , 0 ) else @as (i16 , 0 );
13
+ // ^^^^^^^^^^^^^ (i16)()
16
14
17
- const widened_int_1 = if (runtime_bool ) @as (i16 , 0 ) else @as (i8 , 0 );
18
- _ = widened_int_1 ;
19
- // ^^^^^^^^^^^^^ (i16)()
15
+ const widened_int_1 = if (runtime_bool ) @as (i16 , 0 ) else @as (i8 , 0 );
16
+ // ^^^^^^^^^^^^^ (i16)()
20
17
21
- const optional_0 = if (runtime_bool ) s else @as (? S , s );
22
- _ = optional_0 ;
23
- // ^^^^^^^^^^ (?S)()
18
+ const optional_0 = if (runtime_bool ) s else @as (? S , s );
19
+ // ^^^^^^^^^^ (?S)()
24
20
25
- const optional_1 = if (runtime_bool ) @as (? S , s ) else s ;
26
- _ = optional_1 ;
27
- // ^^^^^^^^^^ (?S)()
21
+ const optional_1 = if (runtime_bool ) @as (? S , s ) else s ;
22
+ // ^^^^^^^^^^ (?S)()
28
23
29
- const optional_2 = if (runtime_bool ) null else s ;
30
- _ = optional_2 ;
31
- // ^^^^^^^^^^ (?S)()
24
+ const optional_2 = if (runtime_bool ) null else s ;
25
+ // ^^^^^^^^^^ (?S)()
32
26
33
- const optional_3 = if (runtime_bool ) s else null ;
34
- _ = optional_3 ;
35
- // ^^^^^^^^^^ (?S)()
27
+ const optional_3 = if (runtime_bool ) s else null ;
28
+ // ^^^^^^^^^^ (?S)()
36
29
37
- const optional_4 = if (runtime_bool ) null else @as (? S , s );
38
- _ = optional_4 ;
39
- // ^^^^^^^^^^ (?S)()
30
+ const optional_4 = if (runtime_bool ) null else @as (? S , s );
31
+ // ^^^^^^^^^^ (?S)()
40
32
41
- const optional_5 = if (runtime_bool ) @as (? S , s ) else null ;
42
- _ = optional_5 ;
43
- // ^^^^^^^^^^ (?S)()
33
+ const optional_5 = if (runtime_bool ) @as (? S , s ) else null ;
34
+ // ^^^^^^^^^^ (?S)()
44
35
45
- const error_set_0 = if (runtime_bool ) error .A else @as (error { A , B }, error .A );
46
- _ = error_set_0 catch {};
47
- // ^^^^^^^^^^^ (error{A,B})()
36
+ const error_set_0 = if (runtime_bool ) error .A else @as (error { A , B }, error .A );
37
+ // ^^^^^^^^^^^ (error{A,B})()
48
38
49
- const error_set_1 = if (runtime_bool ) @as (error { A , B }, error .A ) else error .A ;
50
- _ = error_set_1 catch {};
51
- // ^^^^^^^^^^^ (error{A,B})()
39
+ const error_set_1 = if (runtime_bool ) @as (error { A , B }, error .A ) else error .A ;
40
+ // ^^^^^^^^^^^ (error{A,B})()
52
41
53
- const error_set_2 = if (runtime_bool ) error .B else error .A ;
54
- _ = error_set_2 catch {};
55
- // ^^^^^^^^^^^ (error{B,A})()
42
+ const error_set_2 = if (runtime_bool ) error .B else error .A ;
43
+ // ^^^^^^^^^^^ (error{B,A})()
56
44
57
- const error_set_3 = if (runtime_bool ) error .A else error .B ;
58
- _ = error_set_3 catch {};
59
- // ^^^^^^^^^^^ (error{A,B})()
45
+ const error_set_3 = if (runtime_bool ) error .A else error .B ;
46
+ // ^^^^^^^^^^^ (error{A,B})()
60
47
61
- const error_set_4 = if (runtime_bool ) @as (error { B , C }, error .B ) else @as (error { A , B }, error .A );
62
- _ = error_set_4 catch {};
63
- // ^^^^^^^^^^^ (error{B,C,A})()
48
+ const error_set_4 = if (runtime_bool ) @as (error { B , C }, error .B ) else @as (error { A , B }, error .A );
49
+ // ^^^^^^^^^^^ (error{B,C,A})()
64
50
65
- const error_set_5 = if (runtime_bool ) @as (error { A , B }, error .A ) else @as (error { B , C }, error .B );
66
- _ = error_set_5 catch {};
67
- // ^^^^^^^^^^^ (error{A,B,C})()
51
+ const error_set_5 = if (runtime_bool ) @as (error { A , B }, error .A ) else @as (error { B , C }, error .B );
52
+ // ^^^^^^^^^^^ (error{A,B,C})()
68
53
69
- const error_union_0 = if (runtime_bool ) s else @as (error {A }! S , s );
70
- _ = error_union_0 catch {};
71
- // ^^^^^^^^^^^^^ (error{A}!S)()
54
+ const error_union_0 = if (runtime_bool ) s else @as (error {A }! S , s );
55
+ // ^^^^^^^^^^^^^ (error{A}!S)()
72
56
73
- const error_union_1 = if (runtime_bool ) @as (error {A }! S , s ) else s ;
74
- _ = error_union_1 catch {};
75
- // ^^^^^^^^^^^^^ (error{A}!S)()
57
+ const error_union_1 = if (runtime_bool ) @as (error {A }! S , s ) else s ;
58
+ // ^^^^^^^^^^^^^ (error{A}!S)()
76
59
77
- const error_union_2 = if (runtime_bool ) @as (? S , s ) else @as (error {A }! S , s );
78
- _ = error_union_2 catch {};
79
- // ^^^^^^^^^^^^^ (error{A}!?S)()
60
+ const error_union_2 = if (runtime_bool ) @as (? S , s ) else @as (error {A }! S , s );
61
+ // ^^^^^^^^^^^^^ (error{A}!?S)()
80
62
81
- const error_union_3 = if (runtime_bool ) @as (error {A }! S , s ) else @as (? S , s );
82
- _ = error_union_3 catch {};
83
- // ^^^^^^^^^^^^^ (error{A}!?S)()
63
+ const error_union_3 = if (runtime_bool ) @as (error {A }! S , s ) else @as (? S , s );
64
+ // ^^^^^^^^^^^^^ (error{A}!?S)()
84
65
85
- const error_union_4 = if (runtime_bool ) null else @as (error {A }! S , s );
86
- _ = error_union_4 catch {};
87
- // ^^^^^^^^^^^^^ (error{A}!?S)()
66
+ const error_union_4 = if (runtime_bool ) null else @as (error {A }! S , s );
67
+ // ^^^^^^^^^^^^^ (error{A}!?S)()
88
68
89
- const error_union_5 = if (runtime_bool ) @as (error {A }! S , s ) else null ;
90
- _ = error_union_5 catch {};
91
- // ^^^^^^^^^^^^^ (error{A}!?S)()
69
+ const error_union_5 = if (runtime_bool ) @as (error {A }! S , s ) else null ;
70
+ // ^^^^^^^^^^^^^ (error{A}!?S)()
92
71
93
- const error_union_6 = if (runtime_bool ) @as (error {B }! S , s ) else @as (error {A }! S , s );
94
- _ = error_union_6 catch {};
95
- // ^^^^^^^^^^^^^ (error{B,A}!S)()
72
+ const error_union_6 = if (runtime_bool ) @as (error {B }! S , s ) else @as (error {A }! S , s );
73
+ // ^^^^^^^^^^^^^ (error{B,A}!S)()
96
74
97
- const error_union_7 = if (runtime_bool ) @as (error {A }! S , s ) else @as (error {B }! S , s );
98
- _ = error_union_7 catch {};
99
- // ^^^^^^^^^^^^^ (error{A,B}!S)()
75
+ const error_union_7 = if (runtime_bool ) @as (error {A }! S , s ) else @as (error {B }! S , s );
76
+ // ^^^^^^^^^^^^^ (error{A,B}!S)()
100
77
101
- const error_union_8 = if (runtime_bool ) @as (error {A }! ? S , s ) else @as (error {A }! S , s );
102
- _ = error_union_8 catch {};
103
- // ^^^^^^^^^^^^^ (error{A}!?S)()
78
+ const error_union_8 = if (runtime_bool ) @as (error {A }! ? S , s ) else @as (error {A }! S , s );
79
+ // ^^^^^^^^^^^^^ (error{A}!?S)()
104
80
105
- const error_union_9 = if (runtime_bool ) @as (error {A }! S , s ) else @as (error {A }! ? S , s );
106
- _ = error_union_9 catch {};
107
- // ^^^^^^^^^^^^^ (error{A}!?S)()
81
+ const error_union_9 = if (runtime_bool ) @as (error {A }! S , s ) else @as (error {A }! ? S , s );
82
+ // ^^^^^^^^^^^^^ (error{A}!?S)()
108
83
109
- const error_union_10 = if (runtime_bool ) @as (error {B }! ? S , s ) else @as (error {A }! S , s );
110
- _ = error_union_10 catch {};
111
- // ^^^^^^^^^^^^^^ (error{B,A}!?S)()
84
+ const error_union_10 = if (runtime_bool ) @as (error {B }! ? S , s ) else @as (error {A }! S , s );
85
+ // ^^^^^^^^^^^^^^ (error{B,A}!?S)()
112
86
113
- const error_union_11 = if (runtime_bool ) @as (error {A }! S , s ) else @as (error {B }! ? S , s );
114
- _ = error_union_11 catch {};
115
- // ^^^^^^^^^^^^^^ (error{A,B}!?S)()
87
+ const error_union_11 = if (runtime_bool ) @as (error {A }! S , s ) else @as (error {B }! ? S , s );
88
+ // ^^^^^^^^^^^^^^ (error{A,B}!?S)()
116
89
117
- const error_union_12 = if (runtime_bool ) @as (error {B }! error {A }! S , s ) else @as (error {A }! ? S , s );
118
- _ = try try error_union_12 ;
119
- // ^^^^^^^^^^^^^^ (error{B,A}!error{A}!?S)()
90
+ const error_union_12 = if (runtime_bool ) @as (error {B }! error {A }! S , s ) else @as (error {A }! ? S , s );
91
+ // ^^^^^^^^^^^^^^ (error{B,A}!error{A}!?S)()
120
92
121
- const error_union_13 = if (runtime_bool ) @as (error {A }! ? S , s ) else @as (error {B }! error {A }! S , s );
122
- _ = try try error_union_13 ;
123
- // ^^^^^^^^^^^^^^ (error{A,B}!error{A}!?S)()
93
+ const error_union_13 = if (runtime_bool ) @as (error {A }! ? S , s ) else @as (error {B }! error {A }! S , s );
94
+ // ^^^^^^^^^^^^^^ (error{A,B}!error{A}!?S)()
124
95
125
- const error_union_14 = if (runtime_bool ) @as (error {B }! error {A }! S , s ) else @as (error {A }! error {B }! ? S , s );
126
- _ = try try error_union_14 ;
127
- // ^^^^^^^^^^^^^^ (error{B,A}!error{A,B}!?S)()
96
+ const error_union_14 = if (runtime_bool ) @as (error {B }! error {A }! S , s ) else @as (error {A }! error {B }! ? S , s );
97
+ // ^^^^^^^^^^^^^^ (error{B,A}!error{A,B}!?S)()
128
98
129
- const error_union_15 = if (runtime_bool ) @as (error {A }! error {B }! ? S , s ) else @as (error {B }! error {A }! S , s );
130
- _ = try try error_union_15 ;
131
- // ^^^^^^^^^^^^^^ (error{A,B}!error{B,A}!?S)()
99
+ const error_union_15 = if (runtime_bool ) @as (error {A }! error {B }! ? S , s ) else @as (error {B }! error {A }! S , s );
100
+ // ^^^^^^^^^^^^^^ (error{A,B}!error{B,A}!?S)()
132
101
133
- const error_union_16 = if (runtime_bool ) error .A else s ;
134
- _ = error_union_16 ;
135
- // ^^^^^^^^^^^^^^ (error{A}!S)()
102
+ const error_union_16 = if (runtime_bool ) error .A else s ;
103
+ // ^^^^^^^^^^^^^^ (error{A}!S)()
136
104
137
- const error_union_17 = if (runtime_bool ) s else error .A ;
138
- _ = error_union_17 ;
139
- // ^^^^^^^^^^^^^^ (error{A}!S)()
105
+ const error_union_17 = if (runtime_bool ) s else error .A ;
106
+ // ^^^^^^^^^^^^^^ (error{A}!S)()
140
107
141
- const error_union_18 = if (runtime_bool ) error .A else @as (i32 , 0 );
142
- _ = error_union_18 ;
143
- // ^^^^^^^^^^^^^^ (error{A}!i32)()
108
+ const error_union_18 = if (runtime_bool ) error .A else @as (i32 , 0 );
109
+ // ^^^^^^^^^^^^^^ (error{A}!i32)()
144
110
145
- const error_union_19 = if (runtime_bool ) @as (i32 , 0 ) else error .A ;
146
- _ = error_union_19 ;
147
- // ^^^^^^^^^^^^^^ (error{A}!i32)()
111
+ const error_union_19 = if (runtime_bool ) @as (i32 , 0 ) else error .A ;
112
+ // ^^^^^^^^^^^^^^ (error{A}!i32)()
148
113
149
- const error_union_20 = if (runtime_bool ) error .A else @as (error {B }! S , s );
150
- _ = error_union_20 ;
151
- // ^^^^^^^^^^^^^^ (error{A,B}!S)()
114
+ const error_union_20 = if (runtime_bool ) error .A else @as (error {B }! S , s );
115
+ // ^^^^^^^^^^^^^^ (error{A,B}!S)()
152
116
153
- const error_union_21 = if (runtime_bool ) @as (error {B }! S , s ) else error .A ;
154
- _ = error_union_21 ;
155
- // ^^^^^^^^^^^^^^ (error{A,B}!S)()
117
+ const error_union_21 = if (runtime_bool ) @as (error {B }! S , s ) else error .A ;
118
+ // ^^^^^^^^^^^^^^ (error{A,B}!S)()
156
119
157
- const error_union_22 = if (runtime_bool ) error .A else @as (error {B }! i32 , 0 );
158
- _ = error_union_22 ;
159
- // ^^^^^^^^^^^^^^ (error{A,B}!i32)()
120
+ const error_union_22 = if (runtime_bool ) error .A else @as (error {B }! i32 , 0 );
121
+ // ^^^^^^^^^^^^^^ (error{A,B}!i32)()
160
122
161
- const error_union_23 = if (runtime_bool ) @as (error {B }! i32 , 0 ) else error .A ;
162
- _ = error_union_23 ;
163
- // ^^^^^^^^^^^^^^ (error{A,B}!i32)()
123
+ const error_union_23 = if (runtime_bool ) @as (error {B }! i32 , 0 ) else error .A ;
124
+ // ^^^^^^^^^^^^^^ (error{A,B}!i32)()
164
125
126
+ test "noreturn" {
165
127
const noreturn_0 = if (runtime_bool ) s else return ;
166
128
_ = noreturn_0 ;
167
129
// ^^^^^^^^^^ (S)()
168
130
169
131
const noreturn_1 = if (runtime_bool ) return else s ;
170
132
_ = noreturn_1 ;
171
133
// ^^^^^^^^^^ (S)()
172
-
173
- // Use @compileLog to verify the expected type with the compiler:
174
- // @compileLog(error_union_0);
175
-
176
- _ = & runtime_bool ;
177
134
}
178
135
179
136
const comptime_bool : bool = true ;
0 commit comments