Skip to content

Commit

Permalink
Actually use nqp::const::TYPE_CHECK_xxx constants
Browse files Browse the repository at this point in the history
where appropriate
  • Loading branch information
lizmat committed Mar 13, 2024
1 parent 9b14035 commit 9d7a4c2
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/Perl6/Metamodel/CoercionHOW.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,10 @@ BEGIN {
$metaclass.set_constraint_type($params[1]);
my $coercion_type := nqp::settypehll(nqp::newtype($metaclass, 'Uninstantiable'), 'Raku');
$metaclass.set_language_version($coercion_type, :force);
nqp::settypecheckmode($coercion_type, 2);
nqp::settypecheckmode(
$coercion_type,
nqp::const::TYPE_CHECK_NEEDS_ACCEPTS
);
$coercion_type
});
(Perl6::Metamodel::CoercionHOW.WHO)<root> := $root;
Expand Down
2 changes: 1 addition & 1 deletion src/Perl6/Metamodel/CurriedRoleHOW.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Perl6::Metamodel::CurriedRoleHOW
$meta.compose_invocation($type);
#?endif

nqp::settypecheckmode($type, 2);
nqp::settypecheckmode($type, nqp::const::TYPE_CHECK_NEEDS_ACCEPTS);
}

method parameterize_roles($target) {
Expand Down
2 changes: 1 addition & 1 deletion src/Perl6/Metamodel/DefiniteHOW.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ BEGIN {
nqp::setparameterizer($root, sub ($type, $params) {
# Re-use same HOW.
my $thing := nqp::settypehll(nqp::newtype($type.HOW, 'Uninstantiable'), 'Raku');
nqp::settypecheckmode($thing, 2)
nqp::settypecheckmode($thing, nqp::const::TYPE_CHECK_NEEDS_ACCEPTS)
});
(Perl6::Metamodel::DefiniteHOW.WHO)<root> := $root;
}
Expand Down
5 changes: 4 additions & 1 deletion src/Perl6/Metamodel/ParametricRoleGroupHOW.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,10 @@ class Perl6::Metamodel::ParametricRoleGroupHOW
my @tc := nqp::clone(self.pretending_to_be());
nqp::push(@tc, $target.WHAT);
nqp::settypecache($target, @tc);
nqp::settypecheckmode($target, 1);
nqp::settypecheckmode(
$target,
nqp::const::TYPE_CHECK_CACHE_THEN_METHOD
);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Perl6/Metamodel/SubsetHOW.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Perl6::Metamodel::SubsetHOW
my $type := nqp::settypehll(nqp::newtype($metasubset, 'Uninstantiable'), 'Raku');
$metasubset.set_name($type, $name);
$metasubset.set_language_version($metasubset, :force);
nqp::settypecheckmode($type, 2);
nqp::settypecheckmode($type, nqp::const::TYPE_CHECK_NEEDS_ACCEPTS);
self.add_stash($type)
}

Expand Down
8 changes: 6 additions & 2 deletions src/core.c/Metamodel/Primitives.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ my class Metamodel::Primitives {
nqp::push($cache, nqp::decont($_));
}
nqp::settypecache($type, $cache);
nqp::settypecheckmode($type,
($authoritative ?? 0 !! 1) + ($call_accepts ?? 2 !! 0));
nqp::settypecheckmode($type, $call_accepts
?? nqp::const::TYPE_CHECK_NEEDS_ACCEPTS
!! $authoritative
?? nqp::const::TYPE_CHECK_CACHE_DEFINITIVE
!! nqp::const::TYPE_CHECK_CACHE_THEN_METHOD
);
$type
}

Expand Down

0 comments on commit 9d7a4c2

Please sign in to comment.