| ... | ... | @@ -2,6 +2,15 @@ const tests = @import("tests.zig"); |
| 2 | 2 | const std = @import("std"); |
| 3 | 3 | |
| 4 | 4 | pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 5 | cases.add("non-extern function with var args", |
| 6 | \\fn foo(args: ...) void {} |
| 7 | \\export fn entry() void { |
| 8 | \\ foo(); |
| 9 | \\} |
| 10 | , &[_][]const u8{ |
| 11 | "tmp.zig:1:1: error: non-extern function is variadic", |
| 12 | }); |
| 13 | |
| 5 | 14 | cases.addTest("invalid int casts", |
| 6 | 15 | \\export fn foo() void { |
| 7 | 16 | \\ var a: u32 = 2; |
| ... | ... | @@ -856,7 +865,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 856 | 865 | "tmp.zig:11:25: error: expected type 'u32', found '@TypeOf(get_uval).ReturnType.ErrorSet!u32'", |
| 857 | 866 | }); |
| 858 | 867 | |
| 859 | | cases.add("asigning to struct or union fields that are not optionals with a function that returns an optional", |
| 868 | cases.add("assigning to struct or union fields that are not optionals with a function that returns an optional", |
| 860 | 869 | \\fn maybe(is: bool) ?u8 { |
| 861 | 870 | \\ if (is) return @as(u8, 10) else return null; |
| 862 | 871 | \\} |
| ... | ... | @@ -1084,7 +1093,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 1084 | 1093 | \\ _ = @Type(@typeInfo(struct { })); |
| 1085 | 1094 | \\} |
| 1086 | 1095 | , &[_][]const u8{ |
| 1087 | | "tmp.zig:2:15: error: @Type not availble for 'TypeInfo.Struct'", |
| 1096 | "tmp.zig:2:15: error: @Type not available for 'TypeInfo.Struct'", |
| 1088 | 1097 | }); |
| 1089 | 1098 | |
| 1090 | 1099 | cases.add("wrong type for result ptr to @asyncCall", |
| ... | ... | @@ -2659,7 +2668,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 2659 | 2668 | "tmp.zig:7:17: error: switch on type 'type' provides no expression parameter", |
| 2660 | 2669 | }); |
| 2661 | 2670 | |
| 2662 | | cases.add("function protoype with no body", |
| 2671 | cases.add("function prototype with no body", |
| 2663 | 2672 | \\fn foo() void; |
| 2664 | 2673 | \\export fn entry() void { |
| 2665 | 2674 | \\ foo(); |