File tree 1 file changed +21
-0
lines changed 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -287,6 +287,27 @@ test "inferred empty error set comptime catch" {
287
287
S .foo () catch @compileError ("fail" );
288
288
}
289
289
290
+ test "error inference with an empty set" {
291
+ const S = struct {
292
+ const Struct = struct {
293
+ pub fn func () (error {})! usize {
294
+ return 0 ;
295
+ }
296
+ };
297
+
298
+ fn AnotherStruct (comptime SubStruct : type ) type {
299
+ return struct {
300
+ fn anotherFunc () ! void {
301
+ try expect (0 == (try SubStruct .func ()));
302
+ }
303
+ };
304
+ }
305
+ };
306
+
307
+ const GeneratedStruct = S .AnotherStruct (S .Struct );
308
+ try GeneratedStruct .anotherFunc ();
309
+ }
310
+
290
311
test "error union peer type resolution" {
291
312
if (builtin .zig_backend == .stage2_aarch64 ) return error .SkipZigTest ; // TODO
292
313
if (builtin .zig_backend == .stage2_sparc64 ) return error .SkipZigTest ; // TODO
You can’t perform that action at this time.
0 commit comments