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
Iterating over @(Match) flattens positional captures #935
Comments
From @moritzConsider this: 00:57 <@moritz_> rakudo: 'ab' ~~ m/(.)+/; say $0.WHAT; say $1.WHAT A quantified positional captures places a List into $0, and nothing into 00:57 <@moritz_> rakudo: .say for @('ab' ~~ m/(.)+/) That should be one iteration, where $_ is a List of two Match'es. I also believe that this accounts for a bug in Match.caps, even though I Cheers, |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S05-match/capturing-contexts.t commit a028ec7cdd599cde941391e8d05699a86608dd76 [t/spec] Tests for RT #64952 Inline Patchdiff --git a/t/spec/S05-match/capturing-contexts.t b/t/spec/S05-match/capturing-contexts.t
index 13e54ef..5de209e 100644
--- a/t/spec/S05-match/capturing-contexts.t
+++ b/t/spec/S05-match/capturing-contexts.t
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 20;
+plan 24;
if !eval('("a" ~~ /a/)') {
skip_rest "skipped tests - rules support appears to be missing";
@@ -79,4 +79,16 @@ if !eval('("a" ~~ /a/)') {
'"alpha" exists in Match stored in Hash';
}
+# RT #64952
+{
+ 'ab' ~~ /(.)+/;
+ is $/[0][0], 'a', 'match element [0][0] from /(.)+/';
+ is $/[0][1], 'b', 'match element [0][1] from /(.)+/';
+
+ my @match = @( 'ab' ~~ /(.)+/ );
+ #?rakudo 2 todo 'match coerced to array is flattened (RT #64952)'
+ is @match[0][0], 'a', 'match element [0][0] from /(.)+/ coerced';
+ is @match[0][1], 'b', 'match element [0][1] from /(.)+/ coerced';
+}
+
# vim: ft=perl6 |
The RT System itself - Status changed from 'new' to 'open' |
@moritz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#64952 (status was 'resolved')
Searchable as RT64952$
The text was updated successfully, but these errors were encountered: