authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-07-01 17:28:21-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-07-02 13:28:29-07:00
log7a2e0d98109d39f06400dfbc03c12695557100c6
tree58908c6ff36a758ba8b980dbf7026882912d18af
parent41336acb0bb89dd23ef9c49b15d91a847f6796bc

AstGen: cleanups to pass more compile error test cases


9 files changed, 132 insertions(+), 118 deletions(-)

lib/std/zig/ast.zig+2
...@@ -135,6 +135,8 @@ pub const Tree = struct {...@@ -135,6 +135,8 @@ pub const Tree = struct {
135 const token_tags = tree.tokens.items(.tag);135 const token_tags = tree.tokens.items(.tag);
136 switch (parse_error.tag) {136 switch (parse_error.tag) {
137 .asterisk_after_ptr_deref => {137 .asterisk_after_ptr_deref => {
138 // Note that the token will point at the `.*` but ideally the source
139 // location would point to the `*` after the `.*`.
138 return stream.writeAll("'.*' cannot be followed by '*'. Are you missing a space?");140 return stream.writeAll("'.*' cannot be followed by '*'. Are you missing a space?");
139 },141 },
140 .decl_between_fields => {142 .decl_between_fields => {
lib/std/zig/tokenizer.zig+8-2
...@@ -708,12 +708,18 @@ pub const Tokenizer = struct {...@@ -708,12 +708,18 @@ pub const Tokenizer = struct {
708 self.checkLiteralCharacter();708 self.checkLiteralCharacter();
709 }709 }
710 },710 },
711 '\n', '\r' => break, // Look for this error later.711 '\n' => {
712 result.tag = .invalid;
713 break;
714 },
712 else => self.checkLiteralCharacter(),715 else => self.checkLiteralCharacter(),
713 },716 },
714717
715 .string_literal_backslash => switch (c) {718 .string_literal_backslash => switch (c) {
716 '\n', '\r' => break, // Look for this error later.719 '\n' => {
720 result.tag = .invalid;
721 break;
722 },
717 else => {723 else => {
718 state = .string_literal;724 state = .string_literal;
719 },725 },
src/AstGen.zig+22-11
...@@ -1704,7 +1704,7 @@ fn checkLabelRedefinition(astgen: *AstGen, parent_scope: *Scope, label: ast.Toke...@@ -1704,7 +1704,7 @@ fn checkLabelRedefinition(astgen: *AstGen, parent_scope: *Scope, label: ast.Toke
1704 }, &[_]u32{1704 }, &[_]u32{
1705 try astgen.errNoteTok(1705 try astgen.errNoteTok(
1706 prev_label.token,1706 prev_label.token,
1707 "previous definition is here",1707 "previous definition here",
1708 .{},1708 .{},
1709 ),1709 ),
1710 });1710 });
...@@ -4002,7 +4002,18 @@ fn containerDecl(...@@ -4002,7 +4002,18 @@ fn containerDecl(
4002 return astgen.failTok(comptime_token, "enum fields cannot be marked comptime", .{});4002 return astgen.failTok(comptime_token, "enum fields cannot be marked comptime", .{});
4003 }4003 }
4004 if (member.ast.type_expr != 0) {4004 if (member.ast.type_expr != 0) {
4005 return astgen.failNode(member.ast.type_expr, "enum fields do not have types", .{});4005 return astgen.failNodeNotes(
4006 member.ast.type_expr,
4007 "enum fields do not have types",
4008 .{},
4009 &[_]u32{
4010 try astgen.errNoteNode(
4011 node,
4012 "consider 'union(enum)' here to make it a tagged union",
4013 .{},
4014 ),
4015 },
4016 );
4006 }4017 }
4007 // Alignment expressions in enums are caught by the parser.4018 // Alignment expressions in enums are caught by the parser.
4008 assert(member.ast.align_expr == 0);4019 assert(member.ast.align_expr == 0);
...@@ -4520,7 +4531,7 @@ fn tryExpr(...@@ -4520,7 +4531,7 @@ fn tryExpr(
4520 return astgen.failNode(node, "invalid 'try' outside function scope", .{});4531 return astgen.failNode(node, "invalid 'try' outside function scope", .{});
4521 };4532 };
45224533
4523 if (parent_gz.in_defer) return astgen.failNode(node, "'try' is not allowed inside defer expression", .{});4534 if (parent_gz.in_defer) return astgen.failNode(node, "'try' not allowed inside defer expression", .{});
45244535
4525 var block_scope = parent_gz.makeSubBlock(scope);4536 var block_scope = parent_gz.makeSubBlock(scope);
4526 block_scope.setBreakResultLoc(rl);4537 block_scope.setBreakResultLoc(rl);
...@@ -5526,7 +5537,7 @@ fn switchExpr(...@@ -5526,7 +5537,7 @@ fn switchExpr(
5526 &[_]u32{5537 &[_]u32{
5527 try astgen.errNoteTok(5538 try astgen.errNoteTok(
5528 src,5539 src,
5529 "previous else prong is here",5540 "previous else prong here",
5530 .{},5541 .{},
5531 ),5542 ),
5532 },5543 },
...@@ -5539,12 +5550,12 @@ fn switchExpr(...@@ -5539,12 +5550,12 @@ fn switchExpr(
5539 &[_]u32{5550 &[_]u32{
5540 try astgen.errNoteTok(5551 try astgen.errNoteTok(
5541 case_src,5552 case_src,
5542 "else prong is here",5553 "else prong here",
5543 .{},5554 .{},
5544 ),5555 ),
5545 try astgen.errNoteTok(5556 try astgen.errNoteTok(
5546 some_underscore,5557 some_underscore,
5547 "'_' prong is here",5558 "'_' prong here",
5548 .{},5559 .{},
5549 ),5560 ),
5550 },5561 },
...@@ -5567,7 +5578,7 @@ fn switchExpr(...@@ -5567,7 +5578,7 @@ fn switchExpr(
5567 &[_]u32{5578 &[_]u32{
5568 try astgen.errNoteTok(5579 try astgen.errNoteTok(
5569 src,5580 src,
5570 "previous '_' prong is here",5581 "previous '_' prong here",
5571 .{},5582 .{},
5572 ),5583 ),
5573 },5584 },
...@@ -5580,12 +5591,12 @@ fn switchExpr(...@@ -5580,12 +5591,12 @@ fn switchExpr(
5580 &[_]u32{5591 &[_]u32{
5581 try astgen.errNoteTok(5592 try astgen.errNoteTok(
5582 some_else,5593 some_else,
5583 "else prong is here",5594 "else prong here",
5584 .{},5595 .{},
5585 ),5596 ),
5586 try astgen.errNoteTok(5597 try astgen.errNoteTok(
5587 case_src,5598 case_src,
5588 "'_' prong is here",5599 "'_' prong here",
5589 .{},5600 .{},
5590 ),5601 ),
5591 },5602 },
...@@ -9638,7 +9649,7 @@ fn detectLocalShadowing(...@@ -9638,7 +9649,7 @@ fn detectLocalShadowing(
9638 }, &[_]u32{9649 }, &[_]u32{
9639 try astgen.errNoteTok(9650 try astgen.errNoteTok(
9640 local_val.token_src,9651 local_val.token_src,
9641 "previously declared here",9652 "previous declaration here",
9642 .{},9653 .{},
9643 ),9654 ),
9644 });9655 });
...@@ -9655,7 +9666,7 @@ fn detectLocalShadowing(...@@ -9655,7 +9666,7 @@ fn detectLocalShadowing(
9655 }, &[_]u32{9666 }, &[_]u32{
9656 try astgen.errNoteTok(9667 try astgen.errNoteTok(
9657 local_ptr.token_src,9668 local_ptr.token_src,
9658 "previously declared here",9669 "previous declaration here",
9659 .{},9670 .{},
9660 ),9671 ),
9661 });9672 });
src/stage1/astgen.cpp+7-7
...@@ -3169,7 +3169,7 @@ ZigVar *create_local_var(CodeGen *codegen, AstNode *node, Scope *parent_scope,...@@ -3169,7 +3169,7 @@ ZigVar *create_local_var(CodeGen *codegen, AstNode *node, Scope *parent_scope,
3169 if (existing_var->var_type == nullptr || !type_is_invalid(existing_var->var_type)) {3169 if (existing_var->var_type == nullptr || !type_is_invalid(existing_var->var_type)) {
3170 ErrorMsg *msg = add_node_error(codegen, node,3170 ErrorMsg *msg = add_node_error(codegen, node,
3171 buf_sprintf("redeclaration of variable '%s'", buf_ptr(name)));3171 buf_sprintf("redeclaration of variable '%s'", buf_ptr(name)));
3172 add_error_note(codegen, msg, existing_var->decl_node, buf_sprintf("previous declaration is here"));3172 add_error_note(codegen, msg, existing_var->decl_node, buf_sprintf("previous declaration here"));
3173 }3173 }
3174 variable_entry->var_type = codegen->builtin_types.entry_invalid;3174 variable_entry->var_type = codegen->builtin_types.entry_invalid;
3175 } else {3175 } else {
...@@ -3191,7 +3191,7 @@ ZigVar *create_local_var(CodeGen *codegen, AstNode *node, Scope *parent_scope,...@@ -3191,7 +3191,7 @@ ZigVar *create_local_var(CodeGen *codegen, AstNode *node, Scope *parent_scope,
3191 if (want_err_msg) {3191 if (want_err_msg) {
3192 ErrorMsg *msg = add_node_error(codegen, node,3192 ErrorMsg *msg = add_node_error(codegen, node,
3193 buf_sprintf("redefinition of '%s'", buf_ptr(name)));3193 buf_sprintf("redefinition of '%s'", buf_ptr(name)));
3194 add_error_note(codegen, msg, tld->source_node, buf_sprintf("previous definition is here"));3194 add_error_note(codegen, msg, tld->source_node, buf_sprintf("previous definition here"));
3195 }3195 }
3196 variable_entry->var_type = codegen->builtin_types.entry_invalid;3196 variable_entry->var_type = codegen->builtin_types.entry_invalid;
3197 }3197 }
...@@ -3247,7 +3247,7 @@ static bool is_duplicate_label(CodeGen *g, Scope *scope, AstNode *node, Buf *nam...@@ -3247,7 +3247,7 @@ static bool is_duplicate_label(CodeGen *g, Scope *scope, AstNode *node, Buf *nam
3247 Buf *this_block_name = scope->id == ScopeIdBlock ? ((ScopeBlock *)scope)->name : ((ScopeLoop *)scope)->name;3247 Buf *this_block_name = scope->id == ScopeIdBlock ? ((ScopeBlock *)scope)->name : ((ScopeLoop *)scope)->name;
3248 if (this_block_name != nullptr && buf_eql_buf(name, this_block_name)) {3248 if (this_block_name != nullptr && buf_eql_buf(name, this_block_name)) {
3249 ErrorMsg *msg = add_node_error(g, node, buf_sprintf("redeclaration of label '%s'", buf_ptr(name)));3249 ErrorMsg *msg = add_node_error(g, node, buf_sprintf("redeclaration of label '%s'", buf_ptr(name)));
3250 add_error_note(g, msg, scope->source_node, buf_sprintf("previous declaration is here"));3250 add_error_note(g, msg, scope->source_node, buf_sprintf("previous declaration here"));
3251 return true;3251 return true;
3252 }3252 }
3253 }3253 }
...@@ -7026,7 +7026,7 @@ static IrInstSrc *astgen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no...@@ -7026,7 +7026,7 @@ static IrInstSrc *astgen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no
7026 ErrorMsg *msg = add_node_error(ag->codegen, prong_node,7026 ErrorMsg *msg = add_node_error(ag->codegen, prong_node,
7027 buf_sprintf("multiple else prongs in switch expression"));7027 buf_sprintf("multiple else prongs in switch expression"));
7028 add_error_note(ag->codegen, msg, else_prong,7028 add_error_note(ag->codegen, msg, else_prong,
7029 buf_sprintf("previous else prong is here"));7029 buf_sprintf("previous else prong here"));
7030 return ag->codegen->invalid_inst_src;7030 return ag->codegen->invalid_inst_src;
7031 }7031 }
7032 else_prong = prong_node;7032 else_prong = prong_node;
...@@ -7037,7 +7037,7 @@ static IrInstSrc *astgen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no...@@ -7037,7 +7037,7 @@ static IrInstSrc *astgen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no
7037 ErrorMsg *msg = add_node_error(ag->codegen, prong_node,7037 ErrorMsg *msg = add_node_error(ag->codegen, prong_node,
7038 buf_sprintf("multiple '_' prongs in switch expression"));7038 buf_sprintf("multiple '_' prongs in switch expression"));
7039 add_error_note(ag->codegen, msg, underscore_prong,7039 add_error_note(ag->codegen, msg, underscore_prong,
7040 buf_sprintf("previous '_' prong is here"));7040 buf_sprintf("previous '_' prong here"));
7041 return ag->codegen->invalid_inst_src;7041 return ag->codegen->invalid_inst_src;
7042 }7042 }
7043 underscore_prong = prong_node;7043 underscore_prong = prong_node;
...@@ -7049,10 +7049,10 @@ static IrInstSrc *astgen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no...@@ -7049,10 +7049,10 @@ static IrInstSrc *astgen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no
7049 buf_sprintf("else and '_' prong in switch expression"));7049 buf_sprintf("else and '_' prong in switch expression"));
7050 if (underscore_prong == prong_node)7050 if (underscore_prong == prong_node)
7051 add_error_note(ag->codegen, msg, else_prong,7051 add_error_note(ag->codegen, msg, else_prong,
7052 buf_sprintf("else prong is here"));7052 buf_sprintf("else prong here"));
7053 else7053 else
7054 add_error_note(ag->codegen, msg, underscore_prong,7054 add_error_note(ag->codegen, msg, underscore_prong,
7055 buf_sprintf("'_' prong is here"));7055 buf_sprintf("'_' prong here"));
7056 return ag->codegen->invalid_inst_src;7056 return ag->codegen->invalid_inst_src;
7057 }7057 }
7058 ResultLocPeer *this_peer_result_loc = create_peer_result(peer_parent);7058 ResultLocPeer *this_peer_result_loc = create_peer_result(peer_parent);
src/stage1/ir.cpp+6-6
...@@ -11097,7 +11097,7 @@ static IrInstGen *ir_analyze_instruction_export(IrAnalyze *ira, IrInstSrcExport...@@ -11097,7 +11097,7 @@ static IrInstGen *ir_analyze_instruction_export(IrAnalyze *ira, IrInstSrcExport
11097 AstNode *other_export_node = entry->value->source_node;11097 AstNode *other_export_node = entry->value->source_node;
11098 ErrorMsg *msg = ir_add_error(ira, &instruction->base.base,11098 ErrorMsg *msg = ir_add_error(ira, &instruction->base.base,
11099 buf_sprintf("exported symbol collision: '%s'", buf_ptr(symbol_name)));11099 buf_sprintf("exported symbol collision: '%s'", buf_ptr(symbol_name)));
11100 add_error_note(ira->codegen, msg, other_export_node, buf_sprintf("other symbol is here"));11100 add_error_note(ira->codegen, msg, other_export_node, buf_sprintf("other symbol here"));
11101 return ira->codegen->invalid_inst_gen;11101 return ira->codegen->invalid_inst_gen;
11102 }11102 }
1110311103
...@@ -11403,7 +11403,7 @@ static IrInstGen *ir_analyze_instruction_extern(IrAnalyze *ira, IrInstSrcExtern...@@ -11403,7 +11403,7 @@ static IrInstGen *ir_analyze_instruction_extern(IrAnalyze *ira, IrInstSrcExtern
11403 AstNode *other_extern_node = entry->value->source_node;11403 AstNode *other_extern_node = entry->value->source_node;
11404 ErrorMsg *msg = ir_add_error(ira, &instruction->base.base,11404 ErrorMsg *msg = ir_add_error(ira, &instruction->base.base,
11405 buf_sprintf("extern symbol collision: '%s'", buf_ptr(symbol_name)));11405 buf_sprintf("extern symbol collision: '%s'", buf_ptr(symbol_name)));
11406 add_error_note(ira->codegen, msg, other_extern_node, buf_sprintf("other symbol is here"));11406 add_error_note(ira->codegen, msg, other_extern_node, buf_sprintf("other symbol here"));
11407 return ira->codegen->invalid_inst_gen;11407 return ira->codegen->invalid_inst_gen;
11408 }11408 }
1140911409
...@@ -21732,7 +21732,7 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,...@@ -21732,7 +21732,7 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,
21732 ErrorMsg *msg = ir_add_error(ira, &start_value->base,21732 ErrorMsg *msg = ir_add_error(ira, &start_value->base,
21733 buf_sprintf("duplicate switch value: '%s.%s'", buf_ptr(&switch_type->name),21733 buf_sprintf("duplicate switch value: '%s.%s'", buf_ptr(&switch_type->name),
21734 buf_ptr(enum_field->name)));21734 buf_ptr(enum_field->name)));
21735 add_error_note(ira->codegen, msg, prev_node, buf_sprintf("other value is here"));21735 add_error_note(ira->codegen, msg, prev_node, buf_sprintf("other value here"));
21736 }21736 }
21737 bigint_incr(&field_index);21737 bigint_incr(&field_index);
21738 }21738 }
...@@ -21818,7 +21818,7 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,...@@ -21818,7 +21818,7 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,
21818 Buf *err_name = &ira->codegen->errors_by_index.at(start_index)->name;21818 Buf *err_name = &ira->codegen->errors_by_index.at(start_index)->name;
21819 ErrorMsg *msg = ir_add_error(ira, &start_value->base,21819 ErrorMsg *msg = ir_add_error(ira, &start_value->base,
21820 buf_sprintf("duplicate switch value: '%s.%s'", buf_ptr(&switch_type->name), buf_ptr(err_name)));21820 buf_sprintf("duplicate switch value: '%s.%s'", buf_ptr(&switch_type->name), buf_ptr(err_name)));
21821 add_error_note(ira->codegen, msg, prev_node, buf_sprintf("other value is here"));21821 add_error_note(ira->codegen, msg, prev_node, buf_sprintf("other value here"));
21822 }21822 }
21823 field_prev_uses[start_index] = start_value->base.source_node;21823 field_prev_uses[start_index] = start_value->base.source_node;
21824 }21824 }
...@@ -21880,7 +21880,7 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,...@@ -21880,7 +21880,7 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,
21880 start_value->base.source_node);21880 start_value->base.source_node);
21881 if (prev_node != nullptr) {21881 if (prev_node != nullptr) {
21882 ErrorMsg *msg = ir_add_error(ira, &start_value->base, buf_sprintf("duplicate switch value"));21882 ErrorMsg *msg = ir_add_error(ira, &start_value->base, buf_sprintf("duplicate switch value"));
21883 add_error_note(ira->codegen, msg, prev_node, buf_sprintf("previous value is here"));21883 add_error_note(ira->codegen, msg, prev_node, buf_sprintf("previous value here"));
21884 return ira->codegen->invalid_inst_gen;21884 return ira->codegen->invalid_inst_gen;
21885 }21885 }
21886 }21886 }
...@@ -21965,7 +21965,7 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,...@@ -21965,7 +21965,7 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,
21965 auto entry = prevs.put_unique(const_expr_val->data.x_type, value);21965 auto entry = prevs.put_unique(const_expr_val->data.x_type, value);
21966 if(entry != nullptr) {21966 if(entry != nullptr) {
21967 ErrorMsg *msg = ir_add_error(ira, &value->base, buf_sprintf("duplicate switch value"));21967 ErrorMsg *msg = ir_add_error(ira, &value->base, buf_sprintf("duplicate switch value"));
21968 add_error_note(ira->codegen, msg, entry->value->base.source_node, buf_sprintf("previous value is here"));21968 add_error_note(ira->codegen, msg, entry->value->base.source_node, buf_sprintf("previous value here"));
21969 prevs.deinit();21969 prevs.deinit();
21970 return ira->codegen->invalid_inst_gen;21970 return ira->codegen->invalid_inst_gen;
21971 }21971 }
test/cases.zig+2-2
...@@ -25,7 +25,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -25,7 +25,7 @@ pub fn addCases(ctx: *TestContext) !void {
25 var case = ctx.exe("hello world with updates", linux_x64);25 var case = ctx.exe("hello world with updates", linux_x64);
2626
27 case.addError("", &[_][]const u8{27 case.addError("", &[_][]const u8{
28 ":93:9: error: struct 'test_case.test_case' has no member named 'main'",28 ":93:9: error: struct 'tmp.tmp' has no member named 'main'",
29 });29 });
3030
31 // Incorrect return type31 // Incorrect return type
...@@ -965,7 +965,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -965,7 +965,7 @@ pub fn addCases(ctx: *TestContext) !void {
965 \\ defer return a();965 \\ defer return a();
966 \\}966 \\}
967 , &[_][]const u8{967 , &[_][]const u8{
968 ":7:8: error: try is not allowed inside defer expression",968 ":7:8: error: 'try' not allowed inside defer expression",
969 ":10:8: error: cannot return from defer expression",969 ":10:8: error: cannot return from defer expression",
970 });970 });
971971
test/compile_errors.zig+78-83
...@@ -614,11 +614,11 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -614,11 +614,11 @@ pub fn addCases(ctx: *TestContext) !void {
614 \\}614 \\}
615 , &[_][]const u8{615 , &[_][]const u8{
616 "tmp.zig:2:12: error: redefinition of label 'blk'",616 "tmp.zig:2:12: error: redefinition of label 'blk'",
617 "tmp.zig:2:5: note: previous definition is here",617 "tmp.zig:2:5: note: previous definition here",
618 "tmp.zig:5:26: error: redefinition of label 'blk'",618 "tmp.zig:5:26: error: redefinition of label 'blk'",
619 "tmp.zig:5:5: note: previous definition is here",619 "tmp.zig:5:5: note: previous definition here",
620 "tmp.zig:8:46: error: redefinition of label 'blk'",620 "tmp.zig:8:46: error: redefinition of label 'blk'",
621 "tmp.zig:8:5: note: previous definition is here",621 "tmp.zig:8:5: note: previous definition here",
622 "tmp.zig:11:5: error: unused block label",622 "tmp.zig:11:5: error: unused block label",
623 "tmp.zig:14:5: error: unused while loop label",623 "tmp.zig:14:5: error: unused while loop label",
624 "tmp.zig:17:5: error: unused for loop label",624 "tmp.zig:17:5: error: unused for loop label",
...@@ -4261,7 +4261,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -4261,7 +4261,7 @@ pub fn addCases(ctx: *TestContext) !void {
4261 \\}4261 \\}
4262 , &[_][]const u8{4262 , &[_][]const u8{
4263 "tmp.zig:5:14: error: duplicate switch value: '@typeInfo(@typeInfo(@TypeOf(foo)).Fn.return_type.?).ErrorUnion.error_set.Foo'",4263 "tmp.zig:5:14: error: duplicate switch value: '@typeInfo(@typeInfo(@TypeOf(foo)).Fn.return_type.?).ErrorUnion.error_set.Foo'",
4264 "tmp.zig:3:14: note: other value is here",4264 "tmp.zig:3:14: note: other value here",
4265 });4265 });
42664266
4267 ctx.objErrStage1("invalid cast from integral type to enum",4267 ctx.objErrStage1("invalid cast from integral type to enum",
...@@ -4932,8 +4932,8 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -4932,8 +4932,8 @@ pub fn addCases(ctx: *TestContext) !void {
4932 });4932 });
49334933
4934 ctx.objErrStage1("wrong number of arguments",4934 ctx.objErrStage1("wrong number of arguments",
4935 \\export fn a() void {4935 \\export fn d() void {
4936 \\ b(1);4936 \\ e(1);
4937 \\}4937 \\}
4938 \\fn b(a: i32, b: i32, c: i32) void { _ = a; _ = b; _ = c; }4938 \\fn b(a: i32, b: i32, c: i32) void { _ = a; _ = b; _ = c; }
4939 , &[_][]const u8{4939 , &[_][]const u8{
...@@ -4988,7 +4988,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -4988,7 +4988,7 @@ pub fn addCases(ctx: *TestContext) !void {
4988 \\}4988 \\}
4989 \\export fn entry() void { f(1, 2); }4989 \\export fn entry() void { f(1, 2); }
4990 , &[_][]const u8{4990 , &[_][]const u8{
4991 "tmp.zig:1:15: error: redeclaration of parameter 'a'",4991 "tmp.zig:1:15: error: redeclaration of function parameter 'a'",
4992 "tmp.zig:1:6: note: previous declaration here",4992 "tmp.zig:1:6: note: previous declaration here",
4993 });4993 });
49944994
...@@ -4998,7 +4998,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -4998,7 +4998,7 @@ pub fn addCases(ctx: *TestContext) !void {
4998 \\ var a = 0;4998 \\ var a = 0;
4999 \\}4999 \\}
5000 , &[_][]const u8{5000 , &[_][]const u8{
5001 "tmp.zig:3:9: error: redeclaration of local const 'a'",5001 "tmp.zig:3:9: error: redeclaration of local constant 'a'",
5002 "tmp.zig:2:11: note: previous declaration here",5002 "tmp.zig:2:11: note: previous declaration here",
5003 });5003 });
50045004
...@@ -5008,7 +5008,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -5008,7 +5008,7 @@ pub fn addCases(ctx: *TestContext) !void {
5008 \\}5008 \\}
5009 \\export fn entry() void { f(1); }5009 \\export fn entry() void { f(1); }
5010 , &[_][]const u8{5010 , &[_][]const u8{
5011 "tmp.zig:2:11: error: redeclaration of parameter 'a'",5011 "tmp.zig:2:11: error: redeclaration of function parameter 'a'",
5012 "tmp.zig:1:6: note: previous declaration here",5012 "tmp.zig:1:6: note: previous declaration here",
5013 });5013 });
50145014
...@@ -5295,7 +5295,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -5295,7 +5295,7 @@ pub fn addCases(ctx: *TestContext) !void {
5295 \\ _ = foo;5295 \\ _ = foo;
5296 \\}5296 \\}
5297 , &[_][]const u8{5297 , &[_][]const u8{
5298 "tmp.zig:1:21: error: type '[3]u16' does not support struct initialization syntax",5298 "tmp.zig:1:13: error: initializing array with struct syntax",
5299 });5299 });
53005300
5301 ctx.objErrStage1("type variables must be constant",5301 ctx.objErrStage1("type variables must be constant",
...@@ -5307,23 +5307,28 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -5307,23 +5307,28 @@ pub fn addCases(ctx: *TestContext) !void {
5307 "tmp.zig:1:1: error: variable of type 'type' must be constant",5307 "tmp.zig:1:1: error: variable of type 'type' must be constant",
5308 });5308 });
53095309
5310 ctx.objErrStage1("variables shadowing types",5310 ctx.objErrStage1("parameter shadowing global",
5311 \\const Foo = struct {};
5312 \\fn f(Foo: i32) void {}
5313 \\export fn entry() void {
5314 \\ f(1234);
5315 \\}
5316 , &[_][]const u8{
5317 "tmp.zig:2:6: error: local shadows declaration of 'Foo'",
5318 "tmp.zig:1:1: note: declared here",
5319 });
5320
5321 ctx.objErrStage1("local variable shadowing global",
5311 \\const Foo = struct {};5322 \\const Foo = struct {};
5312 \\const Bar = struct {};5323 \\const Bar = struct {};
5313 \\5324 \\
5314 \\fn f(Foo: i32) void {5325 \\export fn entry() void {
5315 \\ var Bar : i32 = undefined;5326 \\ var Bar : i32 = undefined;
5316 \\ _ = Bar;5327 \\ _ = Bar;
5317 \\}5328 \\}
5318 \\
5319 \\export fn entry() void {
5320 \\ f(1234);
5321 \\}
5322 , &[_][]const u8{5329 , &[_][]const u8{
5323 "tmp.zig:4:6: error: redefinition of 'Foo'",5330 "tmp.zig:5:9: error: local shadows declaration of 'Bar'",
5324 "tmp.zig:1:1: note: previous definition is here",5331 "tmp.zig:2:1: note: declared here",
5325 "tmp.zig:5:5: error: redefinition of 'Bar'",
5326 "tmp.zig:2:1: note: previous definition is here",
5327 });5332 });
53285333
5329 ctx.objErrStage1("switch expression - missing enumeration prong",5334 ctx.objErrStage1("switch expression - missing enumeration prong",
...@@ -5366,7 +5371,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -5366,7 +5371,7 @@ pub fn addCases(ctx: *TestContext) !void {
5366 \\export fn entry() usize { return @sizeOf(@TypeOf(f)); }5371 \\export fn entry() usize { return @sizeOf(@TypeOf(f)); }
5367 , &[_][]const u8{5372 , &[_][]const u8{
5368 "tmp.zig:13:15: error: duplicate switch value",5373 "tmp.zig:13:15: error: duplicate switch value",
5369 "tmp.zig:10:15: note: other value is here",5374 "tmp.zig:10:15: note: other value here",
5370 });5375 });
53715376
5372 ctx.objErrStage1("switch expression - duplicate enumeration prong when else present",5377 ctx.objErrStage1("switch expression - duplicate enumeration prong when else present",
...@@ -5390,7 +5395,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -5390,7 +5395,7 @@ pub fn addCases(ctx: *TestContext) !void {
5390 \\export fn entry() usize { return @sizeOf(@TypeOf(f)); }5395 \\export fn entry() usize { return @sizeOf(@TypeOf(f)); }
5391 , &[_][]const u8{5396 , &[_][]const u8{
5392 "tmp.zig:13:15: error: duplicate switch value",5397 "tmp.zig:13:15: error: duplicate switch value",
5393 "tmp.zig:10:15: note: other value is here",5398 "tmp.zig:10:15: note: other value here",
5394 });5399 });
53955400
5396 ctx.objErrStage1("switch expression - multiple else prongs",5401 ctx.objErrStage1("switch expression - multiple else prongs",
...@@ -5431,7 +5436,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -5431,7 +5436,7 @@ pub fn addCases(ctx: *TestContext) !void {
5431 \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); }5436 \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
5432 , &[_][]const u8{5437 , &[_][]const u8{
5433 "tmp.zig:6:9: error: duplicate switch value",5438 "tmp.zig:6:9: error: duplicate switch value",
5434 "tmp.zig:5:14: note: previous value is here",5439 "tmp.zig:5:14: note: previous value here",
5435 });5440 });
54365441
5437 ctx.objErrStage1("switch expression - duplicate type",5442 ctx.objErrStage1("switch expression - duplicate type",
...@@ -5447,7 +5452,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -5447,7 +5452,7 @@ pub fn addCases(ctx: *TestContext) !void {
5447 \\export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); }5452 \\export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); }
5448 , &[_][]const u8{5453 , &[_][]const u8{
5449 "tmp.zig:6:9: error: duplicate switch value",5454 "tmp.zig:6:9: error: duplicate switch value",
5450 "tmp.zig:4:9: note: previous value is here",5455 "tmp.zig:4:9: note: previous value here",
5451 });5456 });
54525457
5453 ctx.objErrStage1("switch expression - duplicate type (struct alias)",5458 ctx.objErrStage1("switch expression - duplicate type (struct alias)",
...@@ -5467,7 +5472,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -5467,7 +5472,7 @@ pub fn addCases(ctx: *TestContext) !void {
5467 \\export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); }5472 \\export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); }
5468 , &[_][]const u8{5473 , &[_][]const u8{
5469 "tmp.zig:10:9: error: duplicate switch value",5474 "tmp.zig:10:9: error: duplicate switch value",
5470 "tmp.zig:8:9: note: previous value is here",5475 "tmp.zig:8:9: note: previous value here",
5471 });5476 });
54725477
5473 ctx.objErrStage1("switch expression - switch on pointer type with no else",5478 ctx.objErrStage1("switch expression - switch on pointer type with no else",
...@@ -5662,10 +5667,9 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -5662,10 +5667,9 @@ pub fn addCases(ctx: *TestContext) !void {
5662 ctx.objErrStage1("normal string with newline",5667 ctx.objErrStage1("normal string with newline",
5663 \\const foo = "a5668 \\const foo = "a
5664 \\b";5669 \\b";
5665 \\
5666 \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); }
5667 , &[_][]const u8{5670 , &[_][]const u8{
5668 "tmp.zig:1:15: error: newline not allowed in string literal",5671 "tmp.zig:1:13: error: expected expression, found 'invalid'",
5672 "tmp.zig:1:15: note: invalid byte here",
5669 });5673 });
56705674
5671 ctx.objErrStage1("invalid comparison for function pointers",5675 ctx.objErrStage1("invalid comparison for function pointers",
...@@ -6595,7 +6599,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -6595,7 +6599,7 @@ pub fn addCases(ctx: *TestContext) !void {
6595 \\6599 \\
6596 \\export fn entry() usize { return @sizeOf(@TypeOf(testTrickyDefer)); }6600 \\export fn entry() usize { return @sizeOf(@TypeOf(testTrickyDefer)); }
6597 , &[_][]const u8{6601 , &[_][]const u8{
6598 "tmp.zig:4:11: error: 'try' is not allowed inside defer expression",6602 "tmp.zig:4:11: error: 'try' not allowed inside defer expression",
6599 });6603 });
66006604
6601 ctx.objErrStage1("assign too big number to u16",6605 ctx.objErrStage1("assign too big number to u16",
...@@ -6976,7 +6980,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -6976,7 +6980,7 @@ pub fn addCases(ctx: *TestContext) !void {
6976 \\}6980 \\}
6977 , &[_][]const u8{6981 , &[_][]const u8{
6978 "tmp.zig:9:17: error: redefinition of 'Self'",6982 "tmp.zig:9:17: error: redefinition of 'Self'",
6979 "tmp.zig:5:9: note: previous definition is here",6983 "tmp.zig:5:9: note: previous definition here",
6980 });6984 });
69816985
6982 ctx.objErrStage1("while expected bool, got optional",6986 ctx.objErrStage1("while expected bool, got optional",
...@@ -7692,24 +7696,18 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -7692,24 +7696,18 @@ pub fn addCases(ctx: *TestContext) !void {
7692 \\ _ = x;7696 \\ _ = x;
7693 \\}7697 \\}
7694 , &[_][]const u8{7698 , &[_][]const u8{
7695 "tmp.zig:2:14: error: untagged union field assignment",7699 "tmp.zig:1:24: error: explicitly valued tagged union missing integer tag type",
7696 "tmp.zig:1:24: note: consider 'union(enum)' here",7700 "tmp.zig:2:14: note: tag value specified here",
7697 });7701 });
76987702
7699 ctx.objErrStage1("enum with 0 fields",7703 ctx.objErrStage1("enum with 0 fields",
7700 \\const Foo = enum {};7704 \\const Foo = enum {};
7701 \\export fn entry() usize {
7702 \\ return @sizeOf(Foo);
7703 \\}
7704 , &[_][]const u8{7705 , &[_][]const u8{
7705 "tmp.zig:1:13: error: enums must have 1 or more fields",7706 "tmp.zig:1:13: error: enum declarations must have at least one tag",
7706 });7707 });
77077708
7708 ctx.objErrStage1("union with 0 fields",7709 ctx.objErrStage1("union with 0 fields",
7709 \\const Foo = union {};7710 \\const Foo = union {};
7710 \\export fn entry() usize {
7711 \\ return @sizeOf(Foo);
7712 \\}
7713 , &[_][]const u8{7711 , &[_][]const u8{
7714 "tmp.zig:1:13: error: union declarations must have at least one tag",7712 "tmp.zig:1:13: error: union declarations must have at least one tag",
7715 });7713 });
...@@ -7817,13 +7815,9 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -7817,13 +7815,9 @@ pub fn addCases(ctx: *TestContext) !void {
7817 \\ B,7815 \\ B,
7818 \\ C,7816 \\ C,
7819 \\};7817 \\};
7820 \\export fn entry() void {
7821 \\ var b = Letter.B;
7822 \\ _ = b;
7823 \\}
7824 , &[_][]const u8{7818 , &[_][]const u8{
7825 "tmp.zig:2:8: error: structs and unions, not enums, support field types",7819 "tmp.zig:2:8: error: enum fields do not have types",
7826 "tmp.zig:1:16: note: consider 'union(enum)' here",7820 "tmp.zig:1:16: note: consider 'union(enum)' here to make it a tagged union",
7827 });7821 });
78287822
7829 ctx.objErrStage1("struct field missing type",7823 ctx.objErrStage1("struct field missing type",
...@@ -8231,9 +8225,9 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -8231,9 +8225,9 @@ pub fn addCases(ctx: *TestContext) !void {
8231 \\}8225 \\}
8232 , &[_][]const u8{8226 , &[_][]const u8{
8233 "tmp.zig:3:28: error: parameter of opaque type 'FooType' not allowed",8227 "tmp.zig:3:28: error: parameter of opaque type 'FooType' not allowed",
8234 "tmp.zig:7:28: error: parameter of type '(null)' not allowed",8228 "tmp.zig:8:28: error: parameter of type '(null)' not allowed",
8235 "tmp.zig:10:11: error: parameter of opaque type 'FooType' not allowed",8229 "tmp.zig:12:11: error: parameter of opaque type 'FooType' not allowed",
8236 "tmp.zig:15:11: error: parameter of type '(null)' not allowed",8230 "tmp.zig:17:11: error: parameter of type '(null)' not allowed",
8237 });8231 });
82388232
8239 ctx.objErrStage1( // fixed bug #20328233 ctx.objErrStage1( // fixed bug #2032
...@@ -8268,8 +8262,8 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -8268,8 +8262,8 @@ pub fn addCases(ctx: *TestContext) !void {
8268 \\}8262 \\}
8269 , &[_][]const u8{8263 , &[_][]const u8{
8270 "tmp.zig:3:19: error: use of undefined value here causes undefined behavior",8264 "tmp.zig:3:19: error: use of undefined value here causes undefined behavior",
8271 "tmp.zig:8:23: error: use of undefined value here causes undefined behavior",8265 "tmp.zig:9:23: error: use of undefined value here causes undefined behavior",
8272 "tmp.zig:14:23: error: use of undefined value here causes undefined behavior",8266 "tmp.zig:16:23: error: use of undefined value here causes undefined behavior",
8273 });8267 });
82748268
8275 ctx.objErrStage1("issue #3818: bitcast from parray/slice to u16",8269 ctx.objErrStage1("issue #3818: bitcast from parray/slice to u16",
...@@ -8285,8 +8279,8 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -8285,8 +8279,8 @@ pub fn addCases(ctx: *TestContext) !void {
8285 \\}8279 \\}
8286 , &[_][]const u8{8280 , &[_][]const u8{
8287 "tmp.zig:3:42: error: unable to @bitCast from pointer type '*[2]u8'",8281 "tmp.zig:3:42: error: unable to @bitCast from pointer type '*[2]u8'",
8288 "tmp.zig:7:32: error: destination type 'u16' has size 2 but source type '[]const u8' has size 16",8282 "tmp.zig:8:32: error: destination type 'u16' has size 2 but source type '[]const u8' has size 16",
8289 "tmp.zig:7:37: note: referenced here",8283 "tmp.zig:8:37: note: referenced here",
8290 });8284 });
82918285
8292 // issue #78108286 // issue #7810
...@@ -8361,12 +8355,12 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -8361,12 +8355,12 @@ pub fn addCases(ctx: *TestContext) !void {
8361 \\}8355 \\}
8362 , &[_][]const u8{8356 , &[_][]const u8{
8363 ":4:29: error: slice-sentinel is out of bounds",8357 ":4:29: error: slice-sentinel is out of bounds",
8364 ":11:29: error: slice-sentinel is out of bounds",8358 ":12:29: error: slice-sentinel is out of bounds",
8365 ":18:29: error: slice-sentinel is out of bounds",8359 ":20:29: error: slice-sentinel is out of bounds",
8366 ":25:29: error: slice-sentinel is out of bounds",8360 ":28:29: error: slice-sentinel is out of bounds",
8367 ":32:29: error: slice-sentinel is out of bounds",8361 ":36:29: error: slice-sentinel is out of bounds",
8368 ":39:29: error: slice-sentinel is out of bounds",8362 ":44:29: error: slice-sentinel is out of bounds",
8369 ":46:29: error: slice-sentinel is out of bounds",8363 ":52:29: error: slice-sentinel is out of bounds",
8370 });8364 });
83718365
8372 ctx.objErrStage1("comptime slice-sentinel is out of bounds (terminated)",8366 ctx.objErrStage1("comptime slice-sentinel is out of bounds (terminated)",
...@@ -8427,12 +8421,12 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -8427,12 +8421,12 @@ pub fn addCases(ctx: *TestContext) !void {
8427 \\}8421 \\}
8428 , &[_][]const u8{8422 , &[_][]const u8{
8429 ":4:29: error: out of bounds slice",8423 ":4:29: error: out of bounds slice",
8430 ":11:29: error: out of bounds slice",8424 ":12:29: error: out of bounds slice",
8431 ":18:29: error: out of bounds slice",8425 ":20:29: error: out of bounds slice",
8432 ":25:29: error: out of bounds slice",8426 ":28:29: error: out of bounds slice",
8433 ":32:29: error: out of bounds slice",8427 ":36:29: error: out of bounds slice",
8434 ":39:29: error: out of bounds slice",8428 ":44:29: error: out of bounds slice",
8435 ":46:29: error: out of bounds slice",8429 ":52:29: error: out of bounds slice",
8436 });8430 });
84378431
8438 ctx.objErrStage1("comptime slice-sentinel does not match memory at target index (unterminated)",8432 ctx.objErrStage1("comptime slice-sentinel does not match memory at target index (unterminated)",
...@@ -8493,12 +8487,12 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -8493,12 +8487,12 @@ pub fn addCases(ctx: *TestContext) !void {
8493 \\}8487 \\}
8494 , &[_][]const u8{8488 , &[_][]const u8{
8495 ":4:29: error: slice-sentinel does not match memory at target index",8489 ":4:29: error: slice-sentinel does not match memory at target index",
8496 ":11:29: error: slice-sentinel does not match memory at target index",8490 ":12:29: error: slice-sentinel does not match memory at target index",
8497 ":18:29: error: slice-sentinel does not match memory at target index",8491 ":20:29: error: slice-sentinel does not match memory at target index",
8498 ":25:29: error: slice-sentinel does not match memory at target index",8492 ":28:29: error: slice-sentinel does not match memory at target index",
8499 ":32:29: error: slice-sentinel does not match memory at target index",8493 ":36:29: error: slice-sentinel does not match memory at target index",
8500 ":39:29: error: slice-sentinel does not match memory at target index",8494 ":44:29: error: slice-sentinel does not match memory at target index",
8501 ":46:29: error: slice-sentinel does not match memory at target index",8495 ":52:29: error: slice-sentinel does not match memory at target index",
8502 });8496 });
85038497
8504 ctx.objErrStage1("comptime slice-sentinel does not match memory at target index (terminated)",8498 ctx.objErrStage1("comptime slice-sentinel does not match memory at target index (terminated)",
...@@ -8559,12 +8553,12 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -8559,12 +8553,12 @@ pub fn addCases(ctx: *TestContext) !void {
8559 \\}8553 \\}
8560 , &[_][]const u8{8554 , &[_][]const u8{
8561 ":4:29: error: slice-sentinel does not match memory at target index",8555 ":4:29: error: slice-sentinel does not match memory at target index",
8562 ":11:29: error: slice-sentinel does not match memory at target index",8556 ":12:29: error: slice-sentinel does not match memory at target index",
8563 ":18:29: error: slice-sentinel does not match memory at target index",8557 ":20:29: error: slice-sentinel does not match memory at target index",
8564 ":25:29: error: slice-sentinel does not match memory at target index",8558 ":28:29: error: slice-sentinel does not match memory at target index",
8565 ":32:29: error: slice-sentinel does not match memory at target index",8559 ":36:29: error: slice-sentinel does not match memory at target index",
8566 ":39:29: error: slice-sentinel does not match memory at target index",8560 ":44:29: error: slice-sentinel does not match memory at target index",
8567 ":46:29: error: slice-sentinel does not match memory at target index",8561 ":52:29: error: slice-sentinel does not match memory at target index",
8568 });8562 });
85698563
8570 ctx.objErrStage1("comptime slice-sentinel does not match target-sentinel",8564 ctx.objErrStage1("comptime slice-sentinel does not match target-sentinel",
...@@ -8625,12 +8619,12 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -8625,12 +8619,12 @@ pub fn addCases(ctx: *TestContext) !void {
8625 \\}8619 \\}
8626 , &[_][]const u8{8620 , &[_][]const u8{
8627 ":4:29: error: slice-sentinel does not match target-sentinel",8621 ":4:29: error: slice-sentinel does not match target-sentinel",
8628 ":11:29: error: slice-sentinel does not match target-sentinel",8622 ":12:29: error: slice-sentinel does not match target-sentinel",
8629 ":18:29: error: slice-sentinel does not match target-sentinel",8623 ":20:29: error: slice-sentinel does not match target-sentinel",
8630 ":25:29: error: slice-sentinel does not match target-sentinel",8624 ":28:29: error: slice-sentinel does not match target-sentinel",
8631 ":32:29: error: slice-sentinel does not match target-sentinel",8625 ":36:29: error: slice-sentinel does not match target-sentinel",
8632 ":39:29: error: slice-sentinel does not match target-sentinel",8626 ":44:29: error: slice-sentinel does not match target-sentinel",
8633 ":46:29: error: slice-sentinel does not match target-sentinel",8627 ":52:29: error: slice-sentinel does not match target-sentinel",
8634 });8628 });
86358629
8636 ctx.objErrStage1("issue #4207: coerce from non-terminated-slice to terminated-pointer",8630 ctx.objErrStage1("issue #4207: coerce from non-terminated-slice to terminated-pointer",
...@@ -8774,7 +8768,8 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -8774,7 +8768,8 @@ pub fn addCases(ctx: *TestContext) !void {
8774 \\ _ = sequence;8768 \\ _ = sequence;
8775 \\}8769 \\}
8776 , &[_][]const u8{8770 , &[_][]const u8{
8777 "tmp.zig:2:30: error: `.*` cannot be followed by `*`. Are you missing a space?",8771 // Ideally this would be column 30 but it's not very important.
8772 "tmp.zig:2:28: error: `.*` cannot be followed by `*`. Are you missing a space?",
8778 });8773 });
87798774
8780 ctx.objErrStage1("Issue #9165: windows tcp server compilation error",8775 ctx.objErrStage1("Issue #9165: windows tcp server compilation error",
test/stage2/cbe.zig+6-6
...@@ -525,7 +525,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -525,7 +525,7 @@ pub fn addCases(ctx: *TestContext) !void {
525 \\}525 \\}
526 , &.{526 , &.{
527 ":3:21: error: missing struct field: x",527 ":3:21: error: missing struct field: x",
528 ":1:15: note: struct 'test_case.Point' declared here",528 ":1:15: note: struct 'tmp.Point' declared here",
529 });529 });
530 case.addError(530 case.addError(
531 \\const Point = struct { x: i32, y: i32 };531 \\const Point = struct { x: i32, y: i32 };
...@@ -538,7 +538,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -538,7 +538,7 @@ pub fn addCases(ctx: *TestContext) !void {
538 \\ return p.y - p.x - p.x;538 \\ return p.y - p.x - p.x;
539 \\}539 \\}
540 , &.{540 , &.{
541 ":6:10: error: no field named 'z' in struct 'test_case.Point'",541 ":6:10: error: no field named 'z' in struct 'tmp.Point'",
542 ":1:15: note: struct declared here",542 ":1:15: note: struct declared here",
543 });543 });
544 case.addCompareOutput(544 case.addCompareOutput(
...@@ -716,7 +716,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -716,7 +716,7 @@ pub fn addCases(ctx: *TestContext) !void {
716 \\ _ = @intToEnum(E, 3);716 \\ _ = @intToEnum(E, 3);
717 \\}717 \\}
718 , &.{718 , &.{
719 ":3:9: error: enum 'test_case.E' has no tag with value 3",719 ":3:9: error: enum 'tmp.E' has no tag with value 3",
720 ":1:11: note: enum declared here",720 ":1:11: note: enum declared here",
721 });721 });
722722
...@@ -732,7 +732,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -732,7 +732,7 @@ pub fn addCases(ctx: *TestContext) !void {
732 , &.{732 , &.{
733 ":4:5: error: switch must handle all possibilities",733 ":4:5: error: switch must handle all possibilities",
734 ":4:5: note: unhandled enumeration value: 'b'",734 ":4:5: note: unhandled enumeration value: 'b'",
735 ":1:11: note: enum 'test_case.E' declared here",735 ":1:11: note: enum 'tmp.E' declared here",
736 });736 });
737737
738 case.addError(738 case.addError(
...@@ -787,7 +787,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -787,7 +787,7 @@ pub fn addCases(ctx: *TestContext) !void {
787 \\ _ = E.d;787 \\ _ = E.d;
788 \\}788 \\}
789 , &.{789 , &.{
790 ":3:10: error: enum 'test_case.E' has no member named 'd'",790 ":3:10: error: enum 'tmp.E' has no member named 'd'",
791 ":1:11: note: enum declared here",791 ":1:11: note: enum declared here",
792 });792 });
793793
...@@ -798,7 +798,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -798,7 +798,7 @@ pub fn addCases(ctx: *TestContext) !void {
798 \\ _ = x;798 \\ _ = x;
799 \\}799 \\}
800 , &.{800 , &.{
801 ":3:17: error: enum 'test_case.E' has no field named 'd'",801 ":3:17: error: enum 'tmp.E' has no field named 'd'",
802 ":1:11: note: enum declared here",802 ":1:11: note: enum declared here",
803 });803 });
804 }804 }
test/stage2/darwin.zig+1-1
...@@ -14,7 +14,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -14,7 +14,7 @@ pub fn addCases(ctx: *TestContext) !void {
14 {14 {
15 var case = ctx.exe("hello world with updates", target);15 var case = ctx.exe("hello world with updates", target);
16 case.addError("", &[_][]const u8{16 case.addError("", &[_][]const u8{
17 ":93:9: error: struct 'test_case.test_case' has no member named 'main'",17 ":93:9: error: struct 'tmp.tmp' has no member named 'main'",
18 });18 });
1919
20 // Incorrect return type20 // Incorrect return type