From 5d808dd4c4003968bbdf180e1e1193231db5d43b Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sat, 3 Oct 2026 10:08:05 +0200 Subject: Strip outmost constness on infered arguments --- boot/symbol.cc | 11 +++++++++++ boot/type_check.cc | 10 +++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'boot') diff --git a/boot/symbol.cc b/boot/symbol.cc index 2293275..e247bdb 100644 --- a/boot/symbol.cc +++ b/boot/symbol.cc @@ -572,6 +572,17 @@ namespace elna::boot } } + type unqualify(const type& subject) + { + type current = subject; + + while (const auto constant = resolve_aliases(current).get()) + { + current = constant->unqualified; + } + return current; + } + type unwrap_aliases(const type& checked) { if (const auto alias = checked.get()) diff --git a/boot/type_check.cc b/boot/type_check.cc index ea0bcd5..42e7227 100644 --- a/boot/type_check.cc +++ b/boot/type_check.cc @@ -1159,9 +1159,11 @@ namespace elna::boot else if (const auto left_constant = left.get()) { const std::shared_ptr right_constant = right.get(); + const type right_unqualified = right_constant != nullptr + ? right_constant->unqualified + : right; - return right_constant != nullptr - && bind_arguments(parameters, bindings, left_constant->unqualified, right_constant->unqualified); + return bind_arguments(parameters, bindings, left_constant->unqualified, right_unqualified); } else if (const auto left_instance = left.get()) { @@ -1334,8 +1336,10 @@ namespace elna::boot while (argument_iterator != std::cend(call.arguments) && declared_iterator != std::cend(procedure.symbol.parameters)) { + const type actual = unqualify((*argument_iterator)->type_decoration); + if (!bind_arguments(procedure.parameters, bindings, - *declared_iterator, (*argument_iterator)->type_decoration)) + *declared_iterator, actual)) { add_error((*argument_iterator)->position(), reference.name, generic_error::shape_mismatch{ -- cgit v1.2.3