aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-08-14 19:39:28 +0100
committergingerBill <bill@gingerbill.org>2018-08-14 19:39:28 +0100
commit59da98d3f0a36e70027a1aebc0ed22168dff62c7 (patch)
treea557e3f8d7cdaac30ca3ddf244642c10c0e67705 /src/check_expr.cpp
parent2d41a42f61b28cc046321f88b2ab990abd2e1bec (diff)
Improve type hinting for compound literals
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 41b5df135..9629a3e34 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -4249,7 +4249,19 @@ CallArgumentData check_call_arguments(CheckerContext *c, Operand *operand, Type
} else {
operands = array_make<Operand>(heap_allocator(), 0, 2*ce->args.count);
- check_unpack_arguments(c, nullptr, -1, &operands, ce->args, false);
+ Entity **lhs = nullptr;
+ isize lhs_count = -1;
+ if (proc_type != nullptr && is_type_proc(proc_type)) {
+ TypeProc *pt = &base_type(proc_type)->Proc;
+ if (!pt->is_polymorphic || pt->is_poly_specialized) {
+ if (pt->params != nullptr) {
+ lhs = pt->params->Tuple.variables.data;
+ lhs_count = pt->params->Tuple.variables.count;
+ }
+ }
+ }
+
+ check_unpack_arguments(c, lhs, lhs_count, &operands, ce->args, false);
}
if (operand->mode == Addressing_ProcGroup) {