Skip to content

Instantly share code, notes, and snippets.

@niner
Created February 23, 2021 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niner/c5d80085ca27918083ff392e77d2aca8 to your computer and use it in GitHub Desktop.
Save niner/c5d80085ca27918083ff392e77d2aca8 to your computer and use it in GitHub Desktop.
diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp
index e3f286503..cc51eb9e8 100644
--- a/src/Perl6/Actions.nqp
+++ b/src/Perl6/Actions.nqp
@@ -9286,11 +9286,27 @@ class Perl6::Actions is HLL::Actions does STDActions {
QAST::Var.new( :name(get_decont_name()), :scope('local') )
))))));
}
- $var.push(QAST::ParamTypeCheck.new(QAST::Op.new(
- :op('istype_nd'),
- QAST::Var.new( :name(get_decont_name()), :scope('local') ),
- QAST::WVal.new( :value($param_type) )
- )));
+ $var.push(QAST::ParamTypeCheck.new(
+ $is_coercive
+ ?? QAST::Op.new(
+ :op('unless'),
+ QAST::Op.new(
+ :op('istype_nd'),
+ QAST::Var.new( :name(get_decont_name()), :scope('local') ),
+ QAST::WVal.new( :value($param_type.HOW.target_type($param_type)) )
+ ),
+ QAST::Op.new(
+ :op('istype_nd'),
+ QAST::Var.new( :name(get_decont_name()), :scope('local') ),
+ QAST::WVal.new( :value($param_type) )
+ )
+ )
+ !! QAST::Op.new(
+ :op('istype_nd'),
+ QAST::Var.new( :name(get_decont_name()), :scope('local') ),
+ QAST::WVal.new( :value($param_type) )
+ )
+ ));
}
}
if %info<undefined_only> {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment