| ... | @@ -1501,6 +1501,39 @@ fn foo(blah: []u8) { | ... | @@ -1501,6 +1501,39 @@ fn foo(blah: []u8) { |
| 1501 | for (blah) { } | 1501 | for (blah) { } |
| 1502 | } | 1502 | } |
| 1503 | )SOURCE", 1, ".tmp_source.zig:3:16: error: for loop expression missing element parameter"); | 1503 | )SOURCE", 1, ".tmp_source.zig:3:16: error: for loop expression missing element parameter"); |
| | 1504 | |
| | 1505 | add_compile_fail_case("misspelled type with pointer only reference", R"SOURCE( |
| | 1506 | const JasonHM = u8; |
| | 1507 | const JasonList = &JsonNode; |
| | 1508 | |
| | 1509 | enum JsonOA { |
| | 1510 | JSONArray: JsonList, |
| | 1511 | JSONObject: JasonHM, |
| | 1512 | } |
| | 1513 | |
| | 1514 | enum JsonType { |
| | 1515 | JSONNull: void, |
| | 1516 | JSONInteger: isize, |
| | 1517 | JSONDouble: f64, |
| | 1518 | JSONBool: bool, |
| | 1519 | JSONString: []u8, |
| | 1520 | JSONArray, |
| | 1521 | JSONObject, |
| | 1522 | } |
| | 1523 | |
| | 1524 | pub struct JsonNode { |
| | 1525 | kind: JsonType, |
| | 1526 | jobject: ?JsonOA, |
| | 1527 | } |
| | 1528 | |
| | 1529 | fn foo() { |
| | 1530 | var jll: JasonList = undefined; |
| | 1531 | jll.init(&debug.global_allocator); |
| | 1532 | var jd = JsonNode {.kind = JsonType.JSONArray , .jobject = JsonOA.JSONArray {jll} }; |
| | 1533 | } |
| | 1534 | )SOURCE", 2, |
| | 1535 | ".tmp_source.zig:6:16: error: use of undeclared identifier 'JsonList'", |
| | 1536 | ".tmp_source.zig:27:8: error: no function named 'init' in 'JsonNode'"); |
| 1504 | } | 1537 | } |
| 1505 | | 1538 | |
| 1506 | ////////////////////////////////////////////////////////////////////////////// | 1539 | ////////////////////////////////////////////////////////////////////////////// |