New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WHAT() (when called as a subroutine) gives odd results in Rakudo #1370
Comments
From @masak<moritz_> rakudo: sub f1 ($a, $b) { WHAT($a) ~ WHAT($b) }; say f1(a => 42, 23) |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S12-methods/what.t commit b39906abb54f5c227e39afe5100ad41ba8ae60fc [t/spec] Tests for RT #69915 Inline Patchdiff --git a/t/spec/S12-methods/what.t b/t/spec/S12-methods/what.t
index d04c6b0..a9cf632 100644
--- a/t/spec/S12-methods/what.t
+++ b/t/spec/S12-methods/what.t
@@ -1,6 +1,6 @@
use v6;
-
use Test;
+plan *;
=begin pod
@@ -12,8 +12,6 @@ This test tests the C<WHAT> builtin.
# L<S12/Introspection/"WHAT">
-plan 15;
-
# Basic subroutine/method form tests for C<WHAT>.
{
my $a = 3;
@@ -67,4 +65,29 @@ plan 15;
ok &infix:<+>.WHAT ~~ Multi, '.WHAT of built-in infix op is Multi';
}
+# RT #69915
+{
+ sub rt69915f( $a, $b ) { return WHAT($a) ~ '~' ~ WHAT($b) }
+ sub rt69915m( $a, $b ) { return $a.WHAT ~ '~' ~ $b.WHAT }
+
+ is rt69915m( a => 42, 23 ), 'Int()~Int()', 'WHAT method on ints';
+
+ #?rakudo 4 todo 'RT 69915'
+ is rt69915f( a => 42, 23 ), 'Int()~Int()', 'WHAT function on ints (1)';
+ is rt69915f( 23, a => 42 ), 'Int()~Int()', 'WHAT function on ints (2)';
+
+ is rt69915f( :a, 23 ), 'Bool()~Int()', 'WHAT function on bool and int';
+ is rt69915m( :a, 23 ), 'Bool()~Int()', 'WHAT method on bool and int';
+
+ sub wm($x) { return $x.WHAT }
+ sub rt69915wm( $a, $b ) { return wm($a) ~ '~' ~ wm($b) }
+ is rt69915wm( a => 42, 23 ), 'Int()~Int()', 'WHAT method on ints via func';
+
+ sub wf($x) { return WHAT($x) }
+ sub rt69915wf( $a, $b ) { return wf($a) ~ '~' ~ wf($b) }
+ is rt69915wf( a => 42, 23 ), 'Int()~Int()', 'WHAT func on ints via func';
+}
+
+done_testing;
+
# vim: ft=perl6 |
The RT System itself - Status changed from 'new' to 'open' |
From @moritztests now pass; closing ticket |
@moritz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#69915 (status was 'resolved')
Searchable as RT69915$
The text was updated successfully, but these errors were encountered: