diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2023-03-11 14:26:56 +0000 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-03-12 18:47:02 +0200 |
| commit | 948926c513befd95dc1ff90fe05329245f1c81db (patch) | |
| tree | d66d7d70aeac096de253ecb77551ffd87f4a5be1 /test/cases/compile_errors | |
| parent | a097779b611577b75475336ee282615984f77edf (diff) | |
| download | zig-948926c513befd95dc1ff90fe05329245f1c81db.tar.gz zig-948926c513befd95dc1ff90fe05329245f1c81db.zip | |
Sema: improve error message when calling non-member function as method
Resolves: #14880
Diffstat (limited to 'test/cases/compile_errors')
| -rw-r--r-- | test/cases/compile_errors/method_call_with_first_arg_type_primitive.zig | 3 | ||||
| -rw-r--r-- | test/cases/compile_errors/method_call_with_first_arg_type_wrong_container.zig | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/test/cases/compile_errors/method_call_with_first_arg_type_primitive.zig b/test/cases/compile_errors/method_call_with_first_arg_type_primitive.zig index 1cecac6fac..2a5167adf2 100644 --- a/test/cases/compile_errors/method_call_with_first_arg_type_primitive.zig +++ b/test/cases/compile_errors/method_call_with_first_arg_type_primitive.zig @@ -2,7 +2,7 @@ const Foo = struct { x: i32, fn init(x: i32) Foo { - return Foo { + return Foo{ .x = x, }; } @@ -20,3 +20,4 @@ export fn f() void { // // :14:9: error: no field or member function named 'init' in 'tmp.Foo' // :1:13: note: struct declared here +// :4:5: note: 'init' is not a member function diff --git a/test/cases/compile_errors/method_call_with_first_arg_type_wrong_container.zig b/test/cases/compile_errors/method_call_with_first_arg_type_wrong_container.zig index ad481a6158..0653bda3ea 100644 --- a/test/cases/compile_errors/method_call_with_first_arg_type_wrong_container.zig +++ b/test/cases/compile_errors/method_call_with_first_arg_type_wrong_container.zig @@ -29,3 +29,4 @@ export fn foo() void { // // :23:6: error: no field or member function named 'init' in 'tmp.List' // :1:18: note: struct declared here +// :5:9: note: 'init' is not a member function |
