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


*Code:*
sub foo(True) { say ‘ok’ };
foo(False)

*Result:*
ok


The reason for it is the following:

*Code:*
42 ~~ True

*Result:*
Potential difficulties:
    Smartmatch against True always matches; if you mean to test the topic
for truthiness, use :so or *.so or ?* instead
    at -e:1
    ------> 42 ~~ ⏏True


So it is not a bug by itself, it's just how smartmatching works. But we
should definitely print a warning there (or maybe even a compile-time
error?).


IRC log: https://irclog.perlgeek.de/perl6/2016-11-26#i_13632723 and
specifically https://irclog.perlgeek.de/perl6/2016-11-26#i_13632798

Reply via email to