aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-05-04 13:11:56 +0100
committergingerBill <bill@gingerbill.org>2019-05-04 13:11:56 +0100
commita5ff983266f0a5e0717fcffb0cd1d3449b68b3a7 (patch)
tree33179e57466756c048610445103a6d328af2f36a /src/check_expr.cpp
parenta46a1f5f34d281ecede1b446fea7be8834496da5 (diff)
Fix parapoly related bugs #370
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 3ba270845..de409a54e 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -1429,7 +1429,6 @@ bool check_representable_as_constant(CheckerContext *c, ExactValue in_value, Typ
}
}
-
return false;
}
@@ -4352,12 +4351,14 @@ isize add_dependencies_from_unpacking(CheckerContext *c, Entity **lhs, isize lhs
if (lhs != nullptr) {
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(e);
- if (decl != nullptr) {
- c->decl = decl; // will be reset by the 'defer' any way
- for_array(k, decl->deps.entries) {
- Entity *dep = decl->deps.entries[k].ptr;
- add_declaration_dependency(c, dep); // TODO(bill): Should this be here?
+ if (e != nullptr) {
+ DeclInfo *decl = decl_info_of_entity(e);
+ if (decl != nullptr) {
+ c->decl = decl; // will be reset by the 'defer' any way
+ for_array(k, decl->deps.entries) {
+ Entity *dep = decl->deps.entries[k].ptr;
+ add_declaration_dependency(c, dep); // TODO(bill): Should this be here?
+ }
}
}
}
@@ -4438,9 +4439,11 @@ bool check_unpack_arguments(CheckerContext *ctx, Entity **lhs, isize lhs_count,
if (lhs != nullptr && tuple_index < lhs_count) {
// NOTE(bill): override DeclInfo for dependency
Entity *e = lhs[tuple_index];
- DeclInfo *decl = decl_info_of_entity(e);
- if (decl) c->decl = decl;
- type_hint = e->type;
+ if (e != nullptr) {
+ DeclInfo *decl = decl_info_of_entity(e);
+ if (decl) c->decl = decl;
+ type_hint = e->type;
+ }
}
check_expr_base(c, &o, rhs[i], type_hint);
@@ -4943,6 +4946,16 @@ CallArgumentData check_call_arguments(CheckerContext *c, Operand *operand, Type
lhs = pt->params->Tuple.variables.data;
lhs_count = pt->params->Tuple.variables.count;
}
+ } else {
+ // NOTE(bill): Create 'lhs' list in order to ignore parameters which are polymorphic
+ lhs_count = pt->params->Tuple.variables.count;
+ lhs = gb_alloc_array(heap_allocator(), Entity *, lhs_count);
+ for_array(i, pt->params->Tuple.variables) {
+ Entity *e = pt->params->Tuple.variables[i];
+ if (!is_type_polymorphic(e->type)) {
+ lhs[i] = e;
+ }
+ }
}
}