authorgravatar for josh@junon.meJosh Junon <josh@junon.me> 2020-04-04 04:03:06+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-05-08 14:26:13+03:00
logfbf081a3066b4a438e53b58ad2aa564022dfa88d
treebe63a0d5fc63b248f7e4bc3b17632ea6e52b2859
parent9c422c28f62cdc5fc2e675318c58b1b3710f0778
signaturelock-open Commit is signed but in an unrecognized format.

add failing test for #4909


1 files changed, 44 insertions(+), 0 deletions(-)

test/compile_errors.zig+44
...@@ -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 });
53775377
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};