aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-12-27 10:18:32 +0000
committergingerBill <bill@gingerbill.org>2019-12-27 10:18:32 +0000
commiteea403d0abea5db849a7e383c76d53d5c181b5e6 (patch)
tree6014b65fd43cdef20ccf7659eed1a05c2b9a62df /src/check_expr.cpp
parent2cc5c4eed354e7842f37eca61f9a55f6a428930a (diff)
Fix #514
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 0bbf6031d..bfee3d56a 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -4295,10 +4295,13 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
tuple->Tuple.variables[i] = alloc_entity_array_elem(nullptr, blank_token, type->Array.elem, cast(i32)i);
}
}
-
operand->type = tuple;
operand->mode = Addressing_Value;
+ if (tuple->Tuple.variables.count == 1) {
+ operand->type = tuple->Tuple.variables[0]->type;
+ }
+
break;
}
@@ -8360,10 +8363,10 @@ void check_not_tuple(CheckerContext *c, Operand *o) {
// NOTE(bill): Tuples are not first class thus never named
if (o->type->kind == Type_Tuple) {
isize count = o->type->Tuple.variables.count;
- GB_ASSERT(count != 1);
error(o->expr,
"%td-valued tuple found where single value expected", count);
o->mode = Addressing_Invalid;
+ GB_ASSERT(count != 1);
}
}
}