Skip to content
← Back

src/semantic/selected_candidate_bindings.ghul

1
namespace Semantic is
2
use Collections.List
3
4
// Whose type-argument bindings reach the placeholder actuals they
5
// were paired with: the candidate the overload resolver selected,
6
// and no other. Ranking binds every candidate that scores at least
7
// as well as the best so far, and a candidate that bound cleanly and
8
// then lost - on score, or on one of the tie-breaks - said nothing
9
// about what the call means, while the lower bound the offer records
10
// is never withdrawn.
11
class SELECTED_CANDIDATE_BINDINGS is
12
offer(
13
chosen: Symbols.Function,
14
candidates: List[(candidate: Symbols.Function, bindings: Types.GENERIC_ARGUMENT_BIND_RESULTS)]
15
) static is
16
// Ranking records the unspecialized candidate, and what it
17
// selects is the specialization it made of one - specialized
18
// again by the return-constraint filter in some cases - so
19
// the match is against the root of that chain.
20
let root = chosen.root_specialized_from
21
22
for entry in candidates do
23
if entry.candidate == root then
24
entry.bindings.offer_bindings_to_placeholders()
25
fi
26
od
27
si
28
si
29
si