diff options
| author | gingerBill <bill@gingerbill.org> | 2017-12-14 19:56:32 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2017-12-14 19:56:32 +0000 |
| commit | 1b6a14ac39165d848cf5e4fd970d2dc2992fc439 (patch) | |
| tree | 199ea5ee92c86b3a336aae99a7896239c0c093b6 /src/check_expr.cpp | |
| parent | 367013f589b2ae87a0b83410bc4ea770e1263157 (diff) | |
Fix lhs < rhs bug (#164)
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 9981a4543..6ac837529 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -3884,7 +3884,7 @@ break; isize add_dependencies_from_unpacking(Checker *c, Entity **lhs, isize lhs_count, isize tuple_index, isize tuple_count) { if (lhs != nullptr) { - for (isize j = 0; tuple_index < lhs_count && j < tuple_count; j++) { + for (isize j = 0; (tuple_index + j) < lhs_count && j < tuple_count; j++) { Entity *e = lhs[tuple_index + j]; DeclInfo *decl = decl_info_of_entity(&c->info, e); if (decl != nullptr) { @@ -5421,14 +5421,13 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t i64 max = 0; isize index = 0; - isize elem_count = cl->elems.count; Type *bet = base_type(elem_type); if (!elem_type_can_be_constant(bet)) { is_constant = false; } - for (; index < elem_count; index++) { + for (; index < cl->elems.count; index++) { AstNode *e = cl->elems[index]; if (e == nullptr) { error(node, "Invalid literal element"); |