diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-10-03 10:08:05 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-10-03 10:08:05 +0200 |
| commit | 5d808dd4c4003968bbdf180e1e1193231db5d43b (patch) | |
| tree | 6391fc8990790288e76dc8eb6ff7b1a6872dab26 /boot | |
| parent | 2ea84997ae37517729c3c8ed3af8a000bdc632df (diff) | |
| download | elna-5d808dd4c4003968bbdf180e1e1193231db5d43b.tar.gz | |
Strip outmost constness on infered arguments
Diffstat (limited to 'boot')
| -rw-r--r-- | boot/symbol.cc | 11 | ||||
| -rw-r--r-- | boot/type_check.cc | 10 |
2 files changed, 18 insertions, 3 deletions
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<constant_type>()) + { + current = constant->unqualified; + } + return current; + } + type unwrap_aliases(const type& checked) { if (const auto alias = checked.get<alias_type>()) 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<constant_type>()) { const std::shared_ptr<constant_type> right_constant = right.get<constant_type>(); + 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<instantiated_type>()) { @@ -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<generic_error>((*argument_iterator)->position(), reference.name, generic_error::shape_mismatch{ |
