| author | |
| committer | |
| log | 724dcdd384c6c00b9e39ed67867d364287e45f0a |
| tree | 42e617f280fc3016933ad8197b32d82efede1ed6 |
| parent | 9a8851515b8aeac1adcea38094a45e3260e7522c |
2 files changed, 7 insertions(+), 1 deletions(-)
src/analyze.cpp+1-1| ... | ... | @@ -1333,7 +1333,7 @@ static VariableTableEntry *analyze_variable_declaration_raw(CodeGen *g, ImportTa |
| 1333 | 1333 | if (implicit_type->id == TypeTableEntryIdMaybe) { |
| 1334 | 1334 | implicit_type = implicit_type->data.maybe.child_type; |
| 1335 | 1335 | } else { |
| 1336 | add_node_error(g, source_node, buf_sprintf("expected maybe type")); | |
| 1336 | add_node_error(g, variable_declaration->expr, buf_sprintf("expected maybe type")); | |
| 1337 | 1337 | implicit_type = g->builtin_types.entry_invalid; |
| 1338 | 1338 | } |
| 1339 | 1339 | } else if (implicit_type->id == TypeTableEntryIdUnreachable) { |
test/run_tests.cpp+6| ... | ... | @@ -982,6 +982,12 @@ fn f() { |
| 982 | 982 | continue; |
| 983 | 983 | } |
| 984 | 984 | )SOURCE", 1, ".tmp_source.zig:3:5: error: 'continue' expression not in loop"); |
| 985 | ||
| 986 | add_compile_fail_case("invalid maybe type", R"SOURCE( | |
| 987 | fn f() { | |
| 988 | if (const x ?= true) { } | |
| 989 | } | |
| 990 | )SOURCE", 1, ".tmp_source.zig:3:20: error: expected maybe type"); | |
| 985 | 991 | } |
| 986 | 992 | |
| 987 | 993 | static void print_compiler_invocation(TestCase *test_case) { |