| ... | ... | @@ -808,16 +808,29 @@ fn f() { |
| 808 | 808 | } |
| 809 | 809 | )SOURCE", 1, ".tmp_source.zig:3:6: error: invalid token: 'const'"); |
| 810 | 810 | |
| 811 | | add_compile_fail_case("array access errors", R"SOURCE( |
| 811 | add_compile_fail_case("array access of undeclared identifier", R"SOURCE( |
| 812 | 812 | fn f() { |
| 813 | | var bad : bool = undefined; |
| 814 | 813 | i[i] = i[i]; |
| 814 | } |
| 815 | )SOURCE", 2, ".tmp_source.zig:3:5: error: use of undeclared identifier 'i'", |
| 816 | ".tmp_source.zig:3:12: error: use of undeclared identifier 'i'"); |
| 817 | |
| 818 | add_compile_fail_case("array access of non array", R"SOURCE( |
| 819 | fn f() { |
| 820 | var bad : bool = undefined; |
| 815 | 821 | bad[bad] = bad[bad]; |
| 816 | 822 | } |
| 817 | | )SOURCE", 4, ".tmp_source.zig:4:5: error: use of undeclared identifier 'i'", |
| 818 | | ".tmp_source.zig:4:7: error: use of undeclared identifier 'i'", |
| 819 | | ".tmp_source.zig:5:8: error: array access of non-array", |
| 820 | | ".tmp_source.zig:5:9: error: expected type 'usize', found 'bool'"); |
| 823 | )SOURCE", 2, ".tmp_source.zig:4:8: error: array access of non-array type 'bool'", |
| 824 | ".tmp_source.zig:4:19: error: array access of non-array type 'bool'"); |
| 825 | |
| 826 | add_compile_fail_case("array access with non integer index", R"SOURCE( |
| 827 | fn f() { |
| 828 | var array = "aoeu"; |
| 829 | var bad = false; |
| 830 | array[bad] = array[bad]; |
| 831 | } |
| 832 | )SOURCE", 2, ".tmp_source.zig:5:11: error: expected type 'usize', found 'bool'", |
| 833 | ".tmp_source.zig:5:24: error: expected type 'usize', found 'bool'"); |
| 821 | 834 | |
| 822 | 835 | add_compile_fail_case("variadic functions only allowed in extern", R"SOURCE( |
| 823 | 836 | fn f(...) {} |