Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created April 4, 2017 19:37
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 zoffixznet/d74b81e7e95bb93df8c3584b136d3c78 to your computer and use it in GitHub Desktop.
Save zoffixznet/d74b81e7e95bb93df8c3584b136d3c78 to your computer and use it in GitHub Desktop.
cpan@perlbuild2~/CPANPRC/rakudo (nom)$ gd
diff --git a/src/core/traits.pm b/src/core/traits.pm
index ff15d09..f7e870d 100644
--- a/src/core/traits.pm
+++ b/src/core/traits.pm
@@ -144,6 +144,16 @@ multi sub trait_mod:<is>(Routine:D $r, :$onlystar!) {
$r.set_onlystar();
}
multi sub trait_mod:<is>(Routine:D $r, :prec(%spec)!) {
+ nqp::if(
+ nqp::if(
+ nqp::istrue(%spec<assoc>),
+ nqp::if(
+ nqp::iseq_s(%spec<assoc>, 'list'),
+ nqp::isne_s(nqp::substr($r.name, 0, 6), 'infix'),
+ )
+ ),
+ note "\n\n\n\nCannot set `list` assoc on non-infix routine {$r.name}\n\n\n\n"
+ );
my role Precedence {
has %!prec;
proto method prec(|) { * }
cpan@perlbuild2~/CPANPRC/rakudo (nom)$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment