# New Ticket Created by Sam S. # Please include the string: [perl #130965] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=130965 >
sub a ($a) { return True but role { method foo { $a } } } my $x = a 42; say $x.foo; # 42 my $y = a "Hello"; say $y.foo; # Hello say $x.foo; # Hello I have a suspicion that this is not a bug but rather a consequence of classes/roles not being proper closures. But the current behavior is rather LTA in cases like this. Could this possibly be made to emit a warning?