| ... | ... | @@ -136,4 +136,51 @@ pub fn addCases(ctx: *Cases) !void { |
| 136 | 136 | \\const dummy = 0; |
| 137 | 137 | ); |
| 138 | 138 | } |
| 139 | |
| 140 | { |
| 141 | const case = ctx.obj("wrong same named struct", .{}); |
| 142 | |
| 143 | case.addError( |
| 144 | \\const a = @import("a.zig"); |
| 145 | \\const b = @import("b.zig"); |
| 146 | \\ |
| 147 | \\export fn entry() void { |
| 148 | \\ var a1: a.Foo = undefined; |
| 149 | \\ bar(&a1); |
| 150 | \\} |
| 151 | \\ |
| 152 | \\fn bar(_: *b.Foo) void {} |
| 153 | , &[_][]const u8{ |
| 154 | ":6:9: error: expected type '*b.Foo', found '*a.Foo'", |
| 155 | ":6:9: note: pointer type child 'a.Foo' cannot cast into pointer type child 'b.Foo'", |
| 156 | ":1:17: note: struct declared here", |
| 157 | ":1:17: note: struct declared here", |
| 158 | ":9:11: note: parameter type declared here", |
| 159 | }); |
| 160 | |
| 161 | case.addSourceFile("a.zig", |
| 162 | \\pub const Foo = struct { |
| 163 | \\ x: i32, |
| 164 | \\}; |
| 165 | ); |
| 166 | |
| 167 | case.addSourceFile("b.zig", |
| 168 | \\pub const Foo = struct { |
| 169 | \\ z: f64, |
| 170 | \\}; |
| 171 | ); |
| 172 | } |
| 173 | |
| 174 | { |
| 175 | const case = ctx.obj("non-printable invalid character", .{}); |
| 176 | |
| 177 | case.addError("\xff\xfe" ++ |
| 178 | \\export fn foo() bool { |
| 179 | \\ return true; |
| 180 | \\} |
| 181 | , &[_][]const u8{ |
| 182 | ":1:1: error: expected type expression, found 'invalid bytes'", |
| 183 | ":1:1: note: invalid byte: '\\xff'", |
| 184 | }); |
| 185 | } |
| 139 | 186 | } |