| ... | ... | @@ -6538,9 +6538,17 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 6538 | 6538 | \\export fn bar() !FooType { |
| 6539 | 6539 | \\ return error.InvalidValue; |
| 6540 | 6540 | \\} |
| 6541 | \\export fn bav() !@TypeOf(null) { |
| 6542 | \\ return error.InvalidValue; |
| 6543 | \\} |
| 6544 | \\export fn baz() !@TypeOf(undefined) { |
| 6545 | \\ return error.InvalidValue; |
| 6546 | \\} |
| 6541 | 6547 | , &[_][]const u8{ |
| 6542 | | "tmp.zig:2:18: error: return type 'FooType' not allowed", |
| 6548 | "tmp.zig:2:18: error: Opaque return type 'FooType' not allowed", |
| 6543 | 6549 | "tmp.zig:1:1: note: type declared here", |
| 6550 | "tmp.zig:5:18: error: Null return type '(null)' not allowed", |
| 6551 | "tmp.zig:8:18: error: Undefined return type '(undefined)' not allowed", |
| 6544 | 6552 | }); |
| 6545 | 6553 | |
| 6546 | 6554 | cases.add("generic function returning opaque type", |
| ... | ... | @@ -6551,10 +6559,20 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 6551 | 6559 | \\export fn bar() void { |
| 6552 | 6560 | \\ _ = generic(FooType); |
| 6553 | 6561 | \\} |
| 6562 | \\export fn bav() void { |
| 6563 | \\ _ = generic(@TypeOf(null)); |
| 6564 | \\} |
| 6565 | \\export fn baz() void { |
| 6566 | \\ _ = generic(@TypeOf(undefined)); |
| 6567 | \\} |
| 6554 | 6568 | , &[_][]const u8{ |
| 6555 | | "tmp.zig:6:16: error: call to generic function with return type 'FooType' not allowed", |
| 6569 | "tmp.zig:6:16: error: call to generic function with Opaque return type 'FooType' not allowed", |
| 6556 | 6570 | "tmp.zig:2:1: note: function declared here", |
| 6557 | 6571 | "tmp.zig:1:1: note: type declared here", |
| 6572 | "tmp.zig:9:16: error: call to generic function with Null return type '(null)' not allowed", |
| 6573 | "tmp.zig:2:1: note: function declared here", |
| 6574 | "tmp.zig:12:16: error: call to generic function with Undefined return type '(undefined)' not allowed", |
| 6575 | "tmp.zig:2:1: note: function declared here", |
| 6558 | 6576 | }); |
| 6559 | 6577 | |
| 6560 | 6578 | cases.add( // fixed bug #2032 |