| ... | @@ -158,16 +158,22 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -158,16 +158,22 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 158 | \\export fn baz() void { | 158 | \\export fn baz() void { |
| 159 | \\ try bar(); | 159 | \\ try bar(); |
| 160 | \\} | 160 | \\} |
| 161 | \\export fn quux() u32 { | 161 | \\export fn qux() u32 { |
| 162 | \\ return bar(); | 162 | \\ return bar(); |
| 163 | \\} | 163 | \\} |
| | 164 | \\export fn quux() u32 { |
| | 165 | \\ var buf: u32 = 0; |
| | 166 | \\ buf = bar(); |
| | 167 | \\} |
| 164 | , &[_][]const u8{ | 168 | , &[_][]const u8{ |
| 165 | "tmp.zig:2:17: error: expected type 'u32', found 'error{Ohno}'", | 169 | "tmp.zig:2:17: error: expected type 'u32', found 'error{Ohno}'", |
| 166 | "tmp.zig:1:17: note: function cannot return an error", | 170 | "tmp.zig:1:17: note: function cannot return an error", |
| 167 | "tmp.zig:8:5: error: expected type 'void', found '@TypeOf(bar).ReturnType.ErrorSet'", | 171 | "tmp.zig:8:5: error: expected type 'void', found '@TypeOf(bar).ReturnType.ErrorSet'", |
| 168 | "tmp.zig:7:17: note: function cannot return an error", | 172 | "tmp.zig:7:17: note: function cannot return an error", |
| 169 | "tmp.zig:11:15: error: expected type 'u32', found '@TypeOf(bar).ReturnType.ErrorSet!u32'", | 173 | "tmp.zig:11:15: error: expected type 'u32', found '@TypeOf(bar).ReturnType.ErrorSet!u32'", |
| 170 | "tmp.zig:10:18: note: function cannot return an error", | 174 | "tmp.zig:10:17: note: function cannot return an error", |
| | 175 | "tmp.zig:15:14: error: expected type 'u32', found '@TypeOf(bar).ReturnType.ErrorSet!u32'", |
| | 176 | "tmp.zig:14:5: note: cannot store an error in type 'u32'", |
| 171 | }); | 177 | }); |
| 172 | | 178 | |
| 173 | cases.addTest("int/float conversion to comptime_int/float", | 179 | cases.addTest("int/float conversion to comptime_int/float", |