| ... | @@ -2,6 +2,21 @@ const tests = @import("tests.zig"); | ... | @@ -2,6 +2,21 @@ const tests = @import("tests.zig"); |
| 2 | const builtin = @import("builtin"); | 2 | const builtin = @import("builtin"); |
| 3 | | 3 | |
| 4 | pub fn addCases(cases: *tests.CompileErrorContext) void { | 4 | pub fn addCases(cases: *tests.CompileErrorContext) void { |
| | 5 | cases.add( |
| | 6 | "Generic function where return type is self-referenced", |
| | 7 | \\fn Foo(comptime T: type) Foo(T) { |
| | 8 | \\ return struct{ x: T }; |
| | 9 | \\} |
| | 10 | \\export fn entry() void { |
| | 11 | \\ const t = Foo(u32) { |
| | 12 | \\ .x = 1 |
| | 13 | \\ }; |
| | 14 | \\} |
| | 15 | , |
| | 16 | "tmp.zig:1:29: error: evaluation exceeded 1000 backwards branches", |
| | 17 | "tmp.zig:1:29: note: called from here", |
| | 18 | ); |
| | 19 | |
| 5 | cases.add( | 20 | cases.add( |
| 6 | "@ptrToInt 0 to non optional pointer", | 21 | "@ptrToInt 0 to non optional pointer", |
| 7 | \\export fn entry() void { | 22 | \\export fn entry() void { |