| ... | ... | @@ -1452,34 +1452,35 @@ fn function_with_return_type_type() { |
| 1452 | 1452 | ".tmp_source.zig:17:19: note: called from here"); |
| 1453 | 1453 | |
| 1454 | 1454 | add_compile_fail_case("bogus method call on slice", R"SOURCE( |
| 1455 | var self = "aoeu"; |
| 1455 | 1456 | fn f(m: []const u8) { |
| 1456 | | m.copy(u8, self.list.items[old_len...], m); |
| 1457 | m.copy(u8, self[0...], m); |
| 1457 | 1458 | } |
| 1458 | | )SOURCE", 1, ".tmp_source.zig:3:6: error: no member named 'copy' in '[]const u8'"); |
| 1459 | )SOURCE", 1, ".tmp_source.zig:4:6: error: no member named 'copy' in '[]const u8'"); |
| 1459 | 1460 | |
| 1460 | 1461 | add_compile_fail_case("wrong number of arguments for method fn call", R"SOURCE( |
| 1461 | | const Foo = { |
| 1462 | const Foo = struct { |
| 1462 | 1463 | fn method(self: &const Foo, a: i32) {} |
| 1463 | 1464 | }; |
| 1464 | 1465 | fn f(foo: &const Foo) { |
| 1465 | 1466 | |
| 1466 | 1467 | foo.method(1, 2); |
| 1467 | 1468 | } |
| 1468 | | )SOURCE", 1, ".tmp_source.zig:7:15: error: expected 1 arguments, found 2"); |
| 1469 | )SOURCE", 1, ".tmp_source.zig:7:15: error: expected 2 arguments, found 3"); |
| 1469 | 1470 | |
| 1470 | 1471 | add_compile_fail_case("assign through constant pointer", R"SOURCE( |
| 1471 | 1472 | fn f() { |
| 1472 | 1473 | var cstr = c"Hat"; |
| 1473 | 1474 | cstr[0] = 'W'; |
| 1474 | 1475 | } |
| 1475 | | )SOURCE", 1, ".tmp_source.zig:4:7: error: cannot assign to constant"); |
| 1476 | )SOURCE", 1, ".tmp_source.zig:4:11: error: cannot assign to constant"); |
| 1476 | 1477 | |
| 1477 | 1478 | add_compile_fail_case("assign through constant slice", R"SOURCE( |
| 1478 | 1479 | pub fn f() { |
| 1479 | 1480 | var cstr: []const u8 = "Hat"; |
| 1480 | 1481 | cstr[0] = 'W'; |
| 1481 | 1482 | } |
| 1482 | | )SOURCE", 1, ".tmp_source.zig:4:7: error: cannot assign to constant"); |
| 1483 | )SOURCE", 1, ".tmp_source.zig:4:11: error: cannot assign to constant"); |
| 1483 | 1484 | |
| 1484 | 1485 | add_compile_fail_case("main function with bogus args type", R"SOURCE( |
| 1485 | 1486 | pub fn main(args: [][]bogus) -> %void {} |