# New Ticket Created by  Faye 
# Please include the string:  [perl #125745]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=125745 >


<ShimmerFairy> m: class Foo { }; multi sub infix:<~~>(Foo $a, Foo $b) { 42.6 }; 
say Foo.new ~~ Foo; say infix:<~~>(Foo.new, Foo)
<camelia> rakudo-moar a38b59: OUTPUT«True␤42.6␤»
<ShimmerFairy> (basically, the Perl 6 grammar treats ~~ specially, so stuff 
like this and the chaining bug pop up)

To explain, the ~~ infix is one of those operators that src/Perl6/Actions.pm 
treats specially, in this case constructing an AST for the expression with the 
'make_smartmatch' method. The QAST generated by this method bypasses the infix 
and uses the ACCEPTS method on the arguments, meaning definitions of infix:<~~> 
are never used for the operator. (It's potentially possible that the infix:<~~> 
functions found in the core setting aren't used either.)

Bug #81336 may also be caused by this special treatment, since the generated 
QAST (as mentioned) gives no consideration to any defined infix:<~~> functions 
and shortcuts to calling ACCEPTS on the left-hand side.

Reply via email to