Skip to content
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

Cannot loop over Capture object in Rakudo #1590

Closed
p6rt opened this issue Mar 7, 2010 · 11 comments
Closed

Cannot loop over Capture object in Rakudo #1590

p6rt opened this issue Mar 7, 2010 · 11 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Mar 7, 2010

Migrated from rt.perl.org#73400 (status was 'resolved')

Searchable as RT73400$

@p6rt
Copy link
Author

p6rt commented Mar 7, 2010

From @masak

<moritz_> rakudo​: my $i = 0; $i++ for \[1,2,3]; say $i;
<p6eval> rakudo d32a0c​: OUTPUT«Method 'iterator' not found for
invocant of class 'Capture' [...]
<moritz_> that's certainly wrong too
<moritz_> don't you think masak?
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Apr 7, 2010

From @moritz

12​:07 <@​moritz_> rakudo​: say Capture ~~ Positional
12​:07 <+p6eval> rakudo 8c434e​: OUTPUT«0␤»
12​:07 < ruoso> that's a rakudobug
12​:08 <@​moritz_> rakudo​: say Capture ~~ Associative
12​:08 <+p6eval> rakudo 8c434e​: OUTPUT«0␤»
12​:08 < ruoso> that's also a rakudobug
12​:08 <@​moritz_> let's join that into one :-)
12​:08 <@​jnthn> Aye, capture needs to be marked as doing those two.

@p6rt
Copy link
Author

p6rt commented Apr 17, 2010

From @masak

<moritz_> rakudo​: my $x = Capture.new; say $x[0]
<p6eval> rakudo 78faa0​: OUTPUT«Null PMC access in type()
<moritz_> rakudo​: my $x = Capture.new; say $x<a>
<p6eval> rakudo 78faa0​: OUTPUT«Null PMC access in type()
<moritz_> (probably a manifestation of RT #​74110)
* masak adds it to that ticket

@p6rt
Copy link
Author

p6rt commented Apr 17, 2010

From [Unknown Contact. See original ticket]

<moritz_> rakudo​: my $x = Capture.new; say $x[0]
<p6eval> rakudo 78faa0​: OUTPUT«Null PMC access in type()
<moritz_> rakudo​: my $x = Capture.new; say $x<a>
<p6eval> rakudo 78faa0​: OUTPUT«Null PMC access in type()
<moritz_> (probably a manifestation of RT #​74110)
* masak adds it to that ticket

@p6rt
Copy link
Author

p6rt commented Apr 17, 2010

@masak - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jun 29, 2010

From @bbkr

On Kiev build​:

[12​:16] <bbkr> rakudo​: my $i = 0; $i++ for \[1,2,3]; say $i;
[12​:16] <p6eval> rakudo 68852e​: OUTPUT«1␤»

@p6rt
Copy link
Author

p6rt commented Jun 29, 2010

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jun 29, 2010

From @bbkr

[12​:23] <masak> bbkr​: no, I think one iteration is right there. the
prefix​:<\> probably puts it in item context.

Taking ticket for tests...

@p6rt
Copy link
Author

p6rt commented Jun 29, 2010

From @bbkr

tests added in t/spec/S04-statements/for_with_only_one_item.t

@p6rt
Copy link
Author

p6rt commented Jun 29, 2010

@bbkr - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jun 29, 2010
@p6rt
Copy link
Author

p6rt commented Jun 29, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S04-statements/for_with_only_one_item.t

commit 80da87df38b1166278e10ec410e9a3e1062c09b2
Author​: bbkr <bbkr@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Tue Jun 29 12​:54​:21 2010 +0000

  [t/spec] tests for RT #​73400 Cannot loop over Capture object in Rakudo
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31503 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S04-statements/for_with_only_one_item.t b/t/spec/S04-statements/for_with_only_one_item.t
index 03842d0..caf26d6 100644
--- a/t/spec/S04-statements/for_with_only_one_item.t
+++ b/t/spec/S04-statements/for_with_only_one_item.t
@@ -6,7 +6,7 @@ use Test;
 
 # Test primarily aimed at PIL2JS
 
-plan 8;
+plan 9;
 
 # sanity tests
 {
@@ -75,4 +75,13 @@ plan 8;
   is $count, 1, 'for $arrayref {...} executes the loop body only once';
 }
 
+# RT #73400
+{
+  my $capture = \[1,2,3];
+  my $count = 0;
+  for $capture { $count++ }
+
+  is $count, 1, 'for $capture {...} executes the loop body only once';
+}
+
 # vim: ft=perl6

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant