From 4236e870d7090f09c0ff0b90873125573cb2910d Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 21 Apr 2020 23:26:02 +0100 Subject: Fix type assertion bug #619 --- src/check_expr.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/check_expr.cpp') 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 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 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) { -- cgit v1.2.3