diff options
| author | gingerBill <bill@gingerbill.org> | 2020-04-21 23:26:02 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-04-21 23:26:02 +0100 |
| commit | 4236e870d7090f09c0ff0b90873125573cb2910d (patch) | |
| tree | 9dde42ef0ed6037e5902c6fbdaa29a6bf3355b39 /src/check_expr.cpp | |
| parent | f141e2868d5d698618c9cd7cb3ac7e8c7bfc8e9f (diff) | |
Fix type assertion bug #619
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 d43d51e21..af9750ee4 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -5750,9 +5750,8 @@ bool check_assignment_arguments(CheckerContext *ctx, Array<Operand> const &lhs, optional_ok = true; tuple_index += 2; - } else if (o.mode == Addressing_OptionalOk) { + } else if (o.mode == Addressing_OptionalOk && is_type_tuple(o.type)) { Type *tuple = o.type; - GB_ASSERT(is_type_tuple(tuple)); GB_ASSERT(tuple->Tuple.variables.count == 2); Ast *expr = unparen_expr(o.expr); if (expr->kind == Ast_CallExpr) { @@ -5769,7 +5768,7 @@ bool check_assignment_arguments(CheckerContext *ctx, Array<Operand> const &lhs, } } else { TypeTuple *tuple = &o.type->Tuple; - if (o.mode == Addressing_OptionalOk && lhs.count == 1) { + if (o.mode == Addressing_OptionalOk && is_type_tuple(o.type) && lhs.count == 1) { GB_ASSERT(tuple->variables.count == 2); Ast *expr = unparen_expr(o.expr); if (expr->kind == Ast_CallExpr) { |