| ... | @@ -5375,6 +5375,50 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -5375,6 +5375,50 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 5375 | break :x tc; | 5375 | break :x tc; |
| 5376 | }); | 5376 | }); |
| 5377 | | 5377 | |
| | 5378 | cases.addCase(x: { |
| | 5379 | const tc = cases.create("multiple files with private member instance function (canonical invocation) error", |
| | 5380 | \\const Foo = @import("foo.zig",).Foo; |
| | 5381 | \\ |
| | 5382 | \\export fn callPrivFunction() void { |
| | 5383 | \\ var foo = Foo{}; |
| | 5384 | \\ Foo.privateFunction(foo); |
| | 5385 | \\} |
| | 5386 | , &[_][]const u8{ |
| | 5387 | "tmp.zig:5:8: error: 'privateFunction' is private", |
| | 5388 | "foo.zig:2:5: note: declared here", |
| | 5389 | }); |
| | 5390 | |
| | 5391 | tc.addSourceFile("foo.zig", |
| | 5392 | \\pub const Foo = struct { |
| | 5393 | \\ fn privateFunction(self: *Foo) void { } |
| | 5394 | \\}; |
| | 5395 | ); |
| | 5396 | |
| | 5397 | break :x tc; |
| | 5398 | }); |
| | 5399 | |
| | 5400 | cases.addCase(x: { |
| | 5401 | const tc = cases.create("multiple files with private member instance function error", |
| | 5402 | \\const Foo = @import("foo.zig",).Foo; |
| | 5403 | \\ |
| | 5404 | \\export fn callPrivFunction() void { |
| | 5405 | \\ var foo = Foo{}; |
| | 5406 | \\ foo.privateFunction(); |
| | 5407 | \\} |
| | 5408 | , &[_][]const u8{ |
| | 5409 | "tmp.zig:5:8: error: 'privateFunction' is private", |
| | 5410 | "foo.zig:2:5: note: declared here", |
| | 5411 | }); |
| | 5412 | |
| | 5413 | tc.addSourceFile("foo.zig", |
| | 5414 | \\pub const Foo = struct { |
| | 5415 | \\ fn privateFunction(self: *Foo) void { } |
| | 5416 | \\}; |
| | 5417 | ); |
| | 5418 | |
| | 5419 | break :x tc; |
| | 5420 | }); |
| | 5421 | |
| 5378 | cases.add("container init with non-type", | 5422 | cases.add("container init with non-type", |
| 5379 | \\const zero: i32 = 0; | 5423 | \\const zero: i32 = 0; |
| 5380 | \\const a = zero{1}; | 5424 | \\const a = zero{1}; |