AstGen: use usize as result type of for loop range operands

This commit is contained in:
mlugg 2023-06-25 02:24:03 +01:00
parent 5311916928
commit 8afadee45a
No known key found for this signature in database
GPG Key ID: 58978E823BDE3EF9

View File

@ -6480,11 +6480,11 @@ fn forExpr(
return astgen.failTok(ident_tok, "cannot capture reference to range", .{});
}
const start_node = node_data[input].lhs;
const start_val = try expr(parent_gz, scope, .{ .rl = .none }, start_node);
const start_val = try expr(parent_gz, scope, .{ .rl = .{ .coerced_ty = .usize_type } }, start_node);
const end_node = node_data[input].rhs;
const end_val = if (end_node != 0)
try expr(parent_gz, scope, .{ .rl = .none }, node_data[input].rhs)
try expr(parent_gz, scope, .{ .rl = .{ .coerced_ty = .usize_type } }, node_data[input].rhs)
else
.none;