| ... | @@ -4221,6 +4221,11 @@ fn zirForLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. | ... | @@ -4221,6 +4221,11 @@ fn zirForLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 4221 | const msg = try sema.errMsg(block, arg_src, "type '{}' is not indexable and not a range", .{object_ty.fmt(sema.mod)}); | 4221 | const msg = try sema.errMsg(block, arg_src, "type '{}' is not indexable and not a range", .{object_ty.fmt(sema.mod)}); |
| 4222 | errdefer msg.destroy(sema.gpa); | 4222 | errdefer msg.destroy(sema.gpa); |
| 4223 | try sema.errNote(block, arg_src, msg, "for loop operand must be a range, array, slice, tuple, or vector", .{}); | 4223 | try sema.errNote(block, arg_src, msg, "for loop operand must be a range, array, slice, tuple, or vector", .{}); |
| | 4224 | |
| | 4225 | if (object_ty.zigTypeTag(mod) == .ErrorUnion) { |
| | 4226 | try sema.errNote(block, arg_src, msg, "consider using 'try', 'catch', or 'if'", .{}); |
| | 4227 | } |
| | 4228 | |
| 4224 | break :msg msg; | 4229 | break :msg msg; |
| 4225 | }; | 4230 | }; |
| 4226 | return sema.failWithOwnedErrorMsg(block, msg); | 4231 | return sema.failWithOwnedErrorMsg(block, msg); |