authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2021-01-28 22:38:25+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2021-03-06 15:01:25+02:00
log17e6e09285ed29ead1a3de5d5bfeb4d287f23215
tree26dce4f4fd7ec0822aa3c73af8b69ad37a60245e
parent9f722f43ac449caa0e09c1b7bb1bad0581ef323d
signaturelock-open Commit is signed but in an unrecognized format.

stage2: astgen async


4 files changed, 223 insertions(+), 9 deletions(-)

src/Module.zig+69-2
......@@ -370,6 +370,8 @@ pub const Scope = struct {
370370 .gen_zir => return self.cast(GenZIR).?.arena,
371371 .local_val => return self.cast(LocalVal).?.gen_zir.arena,
372372 .local_ptr => return self.cast(LocalPtr).?.gen_zir.arena,
373 .gen_suspend => return self.cast(GenZIR).?.arena,
374 .gen_nosuspend => return self.cast(Nosuspend).?.gen_zir.arena,
373375 .file => unreachable,
374376 .container => unreachable,
375377 }
......@@ -385,6 +387,8 @@ pub const Scope = struct {
385387 .gen_zir => self.cast(GenZIR).?.decl,
386388 .local_val => self.cast(LocalVal).?.gen_zir.decl,
387389 .local_ptr => self.cast(LocalPtr).?.gen_zir.decl,
390 .gen_suspend => return self.cast(GenZIR).?.decl,
391 .gen_nosuspend => return self.cast(Nosuspend).?.gen_zir.decl,
388392 .file => null,
389393 .container => null,
390394 };
......@@ -396,6 +400,8 @@ pub const Scope = struct {
396400 .gen_zir => self.cast(GenZIR).?.decl,
397401 .local_val => self.cast(LocalVal).?.gen_zir.decl,
398402 .local_ptr => self.cast(LocalPtr).?.gen_zir.decl,
403 .gen_suspend => return self.cast(GenZIR).?.decl,
404 .gen_nosuspend => return self.cast(Nosuspend).?.gen_zir.decl,
399405 .file => null,
400406 .container => null,
401407 };
......@@ -410,6 +416,8 @@ pub const Scope = struct {
410416 .local_ptr => return self.cast(LocalPtr).?.gen_zir.decl.container,
411417 .file => return &self.cast(File).?.root_container,
412418 .container => return self.cast(Container).?,
419 .gen_suspend => return self.cast(GenZIR).?.decl.container,
420 .gen_nosuspend => return self.cast(Nosuspend).?.gen_zir.decl.container,
413421 }
414422 }
415423
......@@ -422,6 +430,8 @@ pub const Scope = struct {
422430 .gen_zir => unreachable,
423431 .local_val => unreachable,
424432 .local_ptr => unreachable,
433 .gen_suspend => unreachable,
434 .gen_nosuspend => unreachable,
425435 .file => unreachable,
426436 .container => return self.cast(Container).?.fullyQualifiedNameHash(name),
427437 }
......@@ -436,6 +446,8 @@ pub const Scope = struct {
436446 .local_val => return &self.cast(LocalVal).?.gen_zir.decl.container.file_scope.tree,
437447 .local_ptr => return &self.cast(LocalPtr).?.gen_zir.decl.container.file_scope.tree,
438448 .container => return &self.cast(Container).?.file_scope.tree,
449 .gen_suspend => return &self.cast(GenZIR).?.decl.container.file_scope.tree,
450 .gen_nosuspend => return &self.cast(Nosuspend).?.gen_zir.decl.container.file_scope.tree,
439451 }
440452 }
441453
......@@ -443,9 +455,10 @@ pub const Scope = struct {
443455 pub fn getGenZIR(self: *Scope) *GenZIR {
444456 return switch (self.tag) {
445457 .block => unreachable,
446 .gen_zir => self.cast(GenZIR).?,
458 .gen_zir, .gen_suspend => self.cast(GenZIR).?,
447459 .local_val => return self.cast(LocalVal).?.gen_zir,
448460 .local_ptr => return self.cast(LocalPtr).?.gen_zir,
461 .gen_nosuspend => return self.cast(Nosuspend).?.gen_zir,
449462 .file => unreachable,
450463 .container => unreachable,
451464 };
......@@ -461,6 +474,8 @@ pub const Scope = struct {
461474 .gen_zir => unreachable,
462475 .local_val => unreachable,
463476 .local_ptr => unreachable,
477 .gen_suspend => unreachable,
478 .gen_nosuspend => unreachable,
464479 }
465480 }
466481
......@@ -472,6 +487,8 @@ pub const Scope = struct {
472487 .local_val => unreachable,
473488 .local_ptr => unreachable,
474489 .block => unreachable,
490 .gen_suspend => unreachable,
491 .gen_nosuspend => unreachable,
475492 }
476493 }
477494
......@@ -486,6 +503,36 @@ pub const Scope = struct {
486503 .local_val => @fieldParentPtr(LocalVal, "base", cur).parent,
487504 .local_ptr => @fieldParentPtr(LocalPtr, "base", cur).parent,
488505 .block => return @fieldParentPtr(Block, "base", cur).src_decl.container.file_scope,
506 .gen_suspend => @fieldParentPtr(GenZIR, "base", cur).parent,
507 .gen_nosuspend => @fieldParentPtr(Nosuspend, "base", cur).parent,
508 };
509 }
510 }
511
512 pub fn getSuspend(base: *Scope) ?*Scope.GenZIR {
513 var cur = base;
514 while (true) {
515 cur = switch (cur.tag) {
516 .gen_zir => @fieldParentPtr(GenZIR, "base", cur).parent,
517 .local_val => @fieldParentPtr(LocalVal, "base", cur).parent,
518 .local_ptr => @fieldParentPtr(LocalPtr, "base", cur).parent,
519 .gen_nosuspend => @fieldParentPtr(Nosuspend, "base", cur).parent,
520 .gen_suspend => return @fieldParentPtr(GenZIR, "base", cur),
521 else => return null,
522 };
523 }
524 }
525
526 pub fn getNosuspend(base: *Scope) ?*Scope.Nosuspend {
527 var cur = base;
528 while (true) {
529 cur = switch (cur.tag) {
530 .gen_zir => @fieldParentPtr(GenZIR, "base", cur).parent,
531 .local_val => @fieldParentPtr(LocalVal, "base", cur).parent,
532 .local_ptr => @fieldParentPtr(LocalPtr, "base", cur).parent,
533 .gen_suspend => @fieldParentPtr(GenZIR, "base", cur).parent,
534 .gen_nosuspend => return @fieldParentPtr(Nosuspend, "base", cur),
535 else => return null,
489536 };
490537 }
491538 }
......@@ -507,6 +554,8 @@ pub const Scope = struct {
507554 gen_zir,
508555 local_val,
509556 local_ptr,
557 gen_suspend,
558 gen_nosuspend,
510559 };
511560
512561 pub const Container = struct {
......@@ -740,6 +789,8 @@ pub const Scope = struct {
740789 /// so they can possibly be elided later if the labeled block ends up not needing
741790 /// a result location pointer.
742791 labeled_store_to_block_ptr_list: std.ArrayListUnmanaged(*zir.Inst.BinOp) = .{},
792 /// for suspend error notes
793 src: usize = 0,
743794
744795 pub const Label = struct {
745796 token: ast.TokenIndex,
......@@ -773,6 +824,16 @@ pub const Scope = struct {
773824 name: []const u8,
774825 ptr: *zir.Inst,
775826 };
827
828 pub const Nosuspend = struct {
829 pub const base_tag: Tag = .gen_nosuspend;
830
831 base: Scope = Scope{ .tag = base_tag },
832 /// Parents can be: `LocalVal`, `LocalPtr`, `GenZIR`.
833 parent: *Scope,
834 gen_zir: *GenZIR,
835 src: usize,
836 };
776837};
777838
778839/// This struct holds data necessary to construct API-facing `AllErrors.Message`.
......@@ -3586,7 +3647,7 @@ pub fn failWithOwnedErrorMsg(self: *Module, scope: *Scope, err_msg: *ErrorMsg) I
35863647 }
35873648 self.failed_decls.putAssumeCapacityNoClobber(block.owner_decl, err_msg);
35883649 },
3589 .gen_zir => {
3650 .gen_zir, .gen_suspend => {
35903651 const gen_zir = scope.cast(Scope.GenZIR).?;
35913652 gen_zir.decl.analysis = .sema_failure;
35923653 gen_zir.decl.generation = self.generation;
......@@ -3604,6 +3665,12 @@ pub fn failWithOwnedErrorMsg(self: *Module, scope: *Scope, err_msg: *ErrorMsg) I
36043665 gen_zir.decl.generation = self.generation;
36053666 self.failed_decls.putAssumeCapacityNoClobber(gen_zir.decl, err_msg);
36063667 },
3668 .gen_nosuspend => {
3669 const gen_zir = scope.cast(Scope.Nosuspend).?.gen_zir;
3670 gen_zir.decl.analysis = .sema_failure;
3671 gen_zir.decl.generation = self.generation;
3672 self.failed_decls.putAssumeCapacityNoClobber(gen_zir.decl, err_msg);
3673 },
36073674 .file => unreachable,
36083675 .container => unreachable,
36093676 }
src/astgen.zig+110-5
......@@ -626,10 +626,13 @@ pub fn expr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) In
626626 .@"comptime" => return comptimeExpr(mod, scope, rl, node_datas[node].lhs),
627627 .@"switch", .switch_comma => return switchExpr(mod, scope, rl, node),
628628
629 .@"nosuspend" => return nosuspendExpr(mod, scope, rl, node),
630 .@"suspend" => return rvalue(mod, scope, rl, try suspendExpr(mod, scope, node)),
631 .@"await" => return awaitExpr(mod, scope, rl, node),
632 .@"resume" => return rvalue(mod, scope, rl, try resumeExpr(mod, scope, node)),
633
629634 .@"defer" => return mod.failNode(scope, node, "TODO implement astgen.expr for .defer", .{}),
630635 .@"errdefer" => return mod.failNode(scope, node, "TODO implement astgen.expr for .errdefer", .{}),
631 .@"await" => return mod.failNode(scope, node, "TODO implement astgen.expr for .await", .{}),
632 .@"resume" => return mod.failNode(scope, node, "TODO implement astgen.expr for .resume", .{}),
633636 .@"try" => return mod.failNode(scope, node, "TODO implement astgen.expr for .Try", .{}),
634637
635638 .array_init_one,
......@@ -652,15 +655,12 @@ pub fn expr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) In
652655 .struct_init_comma,
653656 => return mod.failNode(scope, node, "TODO implement astgen.expr for struct literals", .{}),
654657
655 .@"suspend" => return mod.failNode(scope, node, "TODO implement astgen.expr for .suspend", .{}),
656658 .@"anytype" => return mod.failNode(scope, node, "TODO implement astgen.expr for .anytype", .{}),
657659 .fn_proto_simple,
658660 .fn_proto_multi,
659661 .fn_proto_one,
660662 .fn_proto,
661663 => return mod.failNode(scope, node, "TODO implement astgen.expr for function prototypes", .{}),
662
663 .@"nosuspend" => return mod.failNode(scope, node, "TODO implement astgen.expr for .nosuspend", .{}),
664664 }
665665}
666666
......@@ -766,6 +766,8 @@ fn breakExpr(
766766 },
767767 .local_val => scope = scope.cast(Scope.LocalVal).?.parent,
768768 .local_ptr => scope = scope.cast(Scope.LocalPtr).?.parent,
769 .gen_suspend => scope = scope.cast(Scope.GenZIR).?.parent,
770 .gen_nosuspend => scope = scope.cast(Scope.Nosuspend).?.parent,
769771 else => if (break_label != 0) {
770772 const label_name = try mod.identifierTokenString(parent_scope, break_label);
771773 return mod.failTok(parent_scope, break_label, "label not found: '{s}'", .{label_name});
......@@ -819,6 +821,8 @@ fn continueExpr(
819821 },
820822 .local_val => scope = scope.cast(Scope.LocalVal).?.parent,
821823 .local_ptr => scope = scope.cast(Scope.LocalPtr).?.parent,
824 .gen_suspend => scope = scope.cast(Scope.GenZIR).?.parent,
825 .gen_nosuspend => scope = scope.cast(Scope.Nosuspend).?.parent,
822826 else => if (break_label != 0) {
823827 const label_name = try mod.identifierTokenString(parent_scope, break_label);
824828 return mod.failTok(parent_scope, break_label, "label not found: '{s}'", .{label_name});
......@@ -893,6 +897,8 @@ fn checkLabelRedefinition(mod: *Module, parent_scope: *Scope, label: ast.TokenIn
893897 },
894898 .local_val => scope = scope.cast(Scope.LocalVal).?.parent,
895899 .local_ptr => scope = scope.cast(Scope.LocalPtr).?.parent,
900 .gen_suspend => scope = scope.cast(Scope.GenZIR).?.parent,
901 .gen_nosuspend => scope = scope.cast(Scope.Nosuspend).?.parent,
896902 else => return,
897903 }
898904 }
......@@ -1100,6 +1106,8 @@ fn varDecl(
11001106 s = local_ptr.parent;
11011107 },
11021108 .gen_zir => s = s.cast(Scope.GenZIR).?.parent,
1109 .gen_suspend => s = s.cast(Scope.GenZIR).?.parent,
1110 .gen_nosuspend => s = s.cast(Scope.Nosuspend).?.parent,
11031111 else => break,
11041112 };
11051113 }
......@@ -3021,6 +3029,8 @@ fn identifier(
30213029 s = local_ptr.parent;
30223030 },
30233031 .gen_zir => s = s.cast(Scope.GenZIR).?.parent,
3032 .gen_suspend => s = s.cast(Scope.GenZIR).?.parent,
3033 .gen_nosuspend => s = s.cast(Scope.Nosuspend).?.parent,
30243034 else => break,
30253035 };
30263036 }
......@@ -3633,14 +3643,109 @@ fn callExpr(
36333643 }
36343644
36353645 const src = token_starts[call.ast.lparen];
3646 var modifier: std.builtin.CallOptions.Modifier = .auto;
3647 if (call.async_token) |_| modifier = .async_kw;
3648
36363649 const result = try addZIRInst(mod, scope, src, zir.Inst.Call, .{
36373650 .func = lhs,
36383651 .args = args,
3652 .modifier = modifier,
36393653 }, .{});
36403654 // TODO function call with result location
36413655 return rvalue(mod, scope, rl, result);
36423656}
36433657
3658fn suspendExpr(mod: *Module, scope: *Scope, node: ast.Node.Index) InnerError!*zir.Inst {
3659 const tree = scope.tree();
3660 const src = tree.tokens.items(.start)[tree.nodes.items(.main_token)[node]];
3661
3662 if (scope.getNosuspend()) |some| {
3663 const msg = msg: {
3664 const msg = try mod.errMsg(scope, src, "suspend in nosuspend block", .{});
3665 errdefer msg.destroy(mod.gpa);
3666 try mod.errNote(scope, some.src, msg, "nosuspend block here", .{});
3667 break :msg msg;
3668 };
3669 return mod.failWithOwnedErrorMsg(scope, msg);
3670 }
3671
3672 if (scope.getSuspend()) |some| {
3673 const msg = msg: {
3674 const msg = try mod.errMsg(scope, src, "cannot suspend inside suspend block", .{});
3675 errdefer msg.destroy(mod.gpa);
3676 try mod.errNote(scope, some.src, msg, "other suspend block here", .{});
3677 break :msg msg;
3678 };
3679 return mod.failWithOwnedErrorMsg(scope, msg);
3680 }
3681
3682 var suspend_scope: Scope.GenZIR = .{
3683 .base = .{ .tag = .gen_suspend },
3684 .parent = scope,
3685 .decl = scope.ownerDecl().?,
3686 .arena = scope.arena(),
3687 .force_comptime = scope.isComptime(),
3688 .instructions = .{},
3689 };
3690 defer suspend_scope.instructions.deinit(mod.gpa);
3691
3692 const operand = tree.nodes.items(.data)[node].lhs;
3693 if (operand != 0) {
3694 const possibly_unused_result = try expr(mod, &suspend_scope.base, .none, operand);
3695 if (!possibly_unused_result.tag.isNoReturn()) {
3696 _ = try addZIRUnOp(mod, &suspend_scope.base, src, .ensure_result_used, possibly_unused_result);
3697 }
3698 } else {
3699 return addZIRNoOp(mod, scope, src, .@"suspend");
3700 }
3701
3702 const block = try addZIRInstBlock(mod, scope, src, .suspend_block, .{
3703 .instructions = try scope.arena().dupe(*zir.Inst, suspend_scope.instructions.items),
3704 });
3705 return &block.base;
3706}
3707
3708fn nosuspendExpr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) InnerError!*zir.Inst {
3709 const tree = scope.tree();
3710 var child_scope = Scope.Nosuspend{
3711 .parent = scope,
3712 .gen_zir = scope.getGenZIR(),
3713 .src = tree.tokens.items(.start)[tree.nodes.items(.main_token)[node]],
3714 };
3715
3716 return expr(mod, &child_scope.base, rl, tree.nodes.items(.data)[node].lhs);
3717}
3718
3719fn awaitExpr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) InnerError!*zir.Inst {
3720 const tree = scope.tree();
3721 const src = tree.tokens.items(.start)[tree.nodes.items(.main_token)[node]];
3722 const is_nosuspend = scope.getNosuspend() != null;
3723
3724 // TODO some @asyncCall stuff
3725
3726 if (scope.getSuspend()) |some| {
3727 const msg = msg: {
3728 const msg = try mod.errMsg(scope, src, "cannot await inside suspend block", .{});
3729 errdefer msg.destroy(mod.gpa);
3730 try mod.errNote(scope, some.src, msg, "suspend block here", .{});
3731 break :msg msg;
3732 };
3733 return mod.failWithOwnedErrorMsg(scope, msg);
3734 }
3735
3736 const operand = try expr(mod, scope, .ref, tree.nodes.items(.data)[node].lhs);
3737 // TODO pass result location
3738 return addZIRUnOp(mod, scope, src, if (is_nosuspend) .nosuspend_await else .@"await", operand);
3739}
3740
3741fn resumeExpr(mod: *Module, scope: *Scope, node: ast.Node.Index) InnerError!*zir.Inst {
3742 const tree = scope.tree();
3743 const src = tree.tokens.items(.start)[tree.nodes.items(.main_token)[node]];
3744
3745 const operand = try expr(mod, scope, .ref, tree.nodes.items(.data)[node].lhs);
3746 return addZIRUnOp(mod, scope, src, .@"resume", operand);
3747}
3748
36443749pub const simple_types = std.ComptimeStringMap(Value.Tag, .{
36453750 .{ "u8", .u8_type },
36463751 .{ "i8", .i8_type },
src/zir.zig+21
......@@ -61,6 +61,8 @@ pub const Inst = struct {
6161 as,
6262 /// Inline assembly.
6363 @"asm",
64 /// Await an async function.
65 @"await",
6466 /// Bitwise AND. `&`
6567 bit_and,
6668 /// TODO delete this instruction, it has no purpose.
......@@ -212,6 +214,8 @@ pub const Inst = struct {
212214 mul,
213215 /// Twos complement wrapping integer multiplication.
214216 mulwrap,
217 /// An await inside a nosuspend scope.
218 nosuspend_await,
215219 /// Given a reference to a function and a parameter index, returns the
216220 /// type of the parameter. TODO what happens when the parameter is `anytype`?
217221 param_type,
......@@ -226,6 +230,8 @@ pub const Inst = struct {
226230 /// the memory location is in the stack frame, local to the scope containing the
227231 /// instruction.
228232 ref,
233 /// Resume an async function.
234 @"resume",
229235 /// Obtains a pointer to the return value.
230236 ret_ptr,
231237 /// Obtains the return type of the in-scope function.
......@@ -348,6 +354,11 @@ pub const Inst = struct {
348354 enum_type,
349355 /// Does nothing; returns a void value.
350356 void_value,
357 /// Suspend an async function.
358 @"suspend",
359 /// Suspend an async function.
360 /// Same as .suspend but with a block.
361 suspend_block,
351362 /// A switch expression.
352363 switchbr,
353364 /// Same as `switchbr` but the target is a pointer to the value being switched on.
......@@ -369,6 +380,7 @@ pub const Inst = struct {
369380 .unreachable_unsafe,
370381 .unreachable_safe,
371382 .void_value,
383 .@"suspend",
372384 => NoOp,
373385
374386 .alloc,
......@@ -417,6 +429,9 @@ pub const Inst = struct {
417429 .import,
418430 .set_eval_branch_quota,
419431 .indexable_ptr_len,
432 .@"resume",
433 .@"await",
434 .nosuspend_await,
420435 => UnOp,
421436
422437 .add,
......@@ -461,6 +476,7 @@ pub const Inst = struct {
461476 .block_flat,
462477 .block_comptime,
463478 .block_comptime_flat,
479 .suspend_block,
464480 => Block,
465481
466482 .switchbr, .switchbr_ref => SwitchBr,
......@@ -633,6 +649,9 @@ pub const Inst = struct {
633649 .struct_type,
634650 .void_value,
635651 .switch_range,
652 .@"resume",
653 .@"await",
654 .nosuspend_await,
636655 => false,
637656
638657 .@"break",
......@@ -649,6 +668,8 @@ pub const Inst = struct {
649668 .container_field,
650669 .switchbr,
651670 .switchbr_ref,
671 .@"suspend",
672 .suspend_block,
652673 => true,
653674 };
654675 }
src/zir_sema.zig+23-2
......@@ -160,6 +160,11 @@ pub fn analyzeInst(mod: *Module, scope: *Scope, old_inst: *zir.Inst) InnerError!
160160 .switchbr => return zirSwitchBr(mod, scope, old_inst.castTag(.switchbr).?, false),
161161 .switchbr_ref => return zirSwitchBr(mod, scope, old_inst.castTag(.switchbr_ref).?, true),
162162 .switch_range => return zirSwitchRange(mod, scope, old_inst.castTag(.switch_range).?),
163 .@"await" => return zirAwait(mod, scope, old_inst.castTag(.@"await").?),
164 .nosuspend_await => return zirAwait(mod, scope, old_inst.castTag(.nosuspend_await).?),
165 .@"resume" => return zirResume(mod, scope, old_inst.castTag(.@"resume").?),
166 .@"suspend" => return zirSuspend(mod, scope, old_inst.castTag(.@"suspend").?),
167 .suspend_block => return zirSuspendBlock(mod, scope, old_inst.castTag(.suspend_block).?),
163168
164169 .container_field_named,
165170 .container_field_typed,
......@@ -1080,6 +1085,22 @@ fn zirFn(mod: *Module, scope: *Scope, fn_inst: *zir.Inst.Fn) InnerError!*Inst {
10801085 });
10811086}
10821087
1088fn zirAwait(mod: *Module, scope: *Scope, inst: *zir.Inst.UnOp) InnerError!*Inst {
1089 return mod.fail(scope, inst.base.src, "TODO implement await", .{});
1090}
1091
1092fn zirResume(mod: *Module, scope: *Scope, inst: *zir.Inst.UnOp) InnerError!*Inst {
1093 return mod.fail(scope, inst.base.src, "TODO implement resume", .{});
1094}
1095
1096fn zirSuspend(mod: *Module, scope: *Scope, inst: *zir.Inst.NoOp) InnerError!*Inst {
1097 return mod.fail(scope, inst.base.src, "TODO implement suspend", .{});
1098}
1099
1100fn zirSuspendBlock(mod: *Module, scope: *Scope, inst: *zir.Inst.Block) InnerError!*Inst {
1101 return mod.fail(scope, inst.base.src, "TODO implement suspend", .{});
1102}
1103
10831104fn zirIntType(mod: *Module, scope: *Scope, inttype: *zir.Inst.IntType) InnerError!*Inst {
10841105 const tracy = trace(@src());
10851106 defer tracy.end();
......@@ -2046,7 +2067,7 @@ fn zirBitwise(mod: *Module, scope: *Scope, inst: *zir.Inst.BinOp) InnerError!*In
20462067 rhs.ty.arrayLen(),
20472068 });
20482069 }
2049 return mod.fail(scope, inst.base.src, "TODO implement support for vectors in analyzeInstBitwise", .{});
2070 return mod.fail(scope, inst.base.src, "TODO implement support for vectors in zirBitwise", .{});
20502071 } else if (lhs.ty.zigTypeTag() == .Vector or rhs.ty.zigTypeTag() == .Vector) {
20512072 return mod.fail(scope, inst.base.src, "mixed scalar and vector operands to binary expression: '{}' and '{}'", .{
20522073 lhs.ty,
......@@ -2127,7 +2148,7 @@ fn zirArithmetic(mod: *Module, scope: *Scope, inst: *zir.Inst.BinOp) InnerError!
21272148 rhs.ty.arrayLen(),
21282149 });
21292150 }
2130 return mod.fail(scope, inst.base.src, "TODO implement support for vectors in analyzeInstBinOp", .{});
2151 return mod.fail(scope, inst.base.src, "TODO implement support for vectors in zirBinOp", .{});
21312152 } else if (lhs.ty.zigTypeTag() == .Vector or rhs.ty.zigTypeTag() == .Vector) {
21322153 return mod.fail(scope, inst.base.src, "mixed scalar and vector operands to binary expression: '{}' and '{}'", .{
21332154 lhs.ty,