Skip to content

Commit

Permalink
Sort multi-candidates with signature constraint in mind
Browse files Browse the repository at this point in the history
Mark multi-candidates with signature constrained parameters as
`bind_check` and `constrainty`. Resolve ambiguous matching.
  • Loading branch information
vrurg committed Sep 30, 2021
1 parent 9c2cc9c commit ffb587f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Perl6/bootstrap.c/BOOTSTRAP.nqp
Expand Up @@ -2502,7 +2502,9 @@ BEGIN {
# to check constraint on every dispatch. Same if it's got a
# `where` clause.
unless nqp::isnull(nqp::getattr($param, Parameter, '$!sub_signature')) &&
nqp::isnull(nqp::getattr($param, Parameter, '@!post_constraints')) {
nqp::isnull(nqp::getattr($param, Parameter, '@!post_constraints')) &&
nqp::not_i(nqp::can($param, 'signature-constraint'))
{
%info<bind_check> := 1;
%info<constrainty> := 1;
}
Expand Down Expand Up @@ -2572,7 +2574,8 @@ BEGIN {
}
%info<types>[$significant_param] := $ptype;
}
unless nqp::isnull(nqp::getattr($param, Parameter, '@!post_constraints')) {
unless nqp::isnull(nqp::getattr($param, Parameter, '@!post_constraints'))
&& nqp::not_i(nqp::can($param, 'signature-constraint')) {
%info<constraints>[$significant_param] := 1;
}
if $flags +& $SIG_ELEM_MULTI_INVOCANT {
Expand Down

0 comments on commit ffb587f

Please sign in to comment.