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

Inconsistent behaviour when iterating over %*VM.kv #1081

Closed
p6rt opened this issue Jun 21, 2009 · 5 comments
Closed

Inconsistent behaviour when iterating over %*VM.kv #1081

p6rt opened this issue Jun 21, 2009 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jun 21, 2009

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

Searchable as RT66818$

@p6rt
Copy link
Author

p6rt commented Jun 21, 2009

From @moritz

The %*VM hash has the following structure

%*VM = (
  config => {
  '-Wcomment' => 1,
  '-Wall' => 1,
  # many more items here
  }
);

as can easily be seen by %*VM.perl, and $*VM.keys has one item. However
iterating over $*VM.kv shows more than one key​:

$ perl6 -e 'my $keys = 0; for %*VM.kv -> $k, $v { $keys++}; say $keys'
141

Somehow the inner hash is flattened. Using a normal hash I couldn't
reproduce
this behaviour.

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Jul 1, 2009

From @pmichaud

On Sun Jun 21 10​:44​:43 2009, moritz wrote​:

iterating over $*VM.kv shows more than one key​:

$ perl6 -e 'my $keys = 0; for %*VM.kv -> $k, $v { $keys++}; say $keys'
141

Somehow the inner hash is flattened. Using a normal hash I couldn't
reproduce
this behaviour.

Now fixed in 6c6299f​:

  $ ./perl6 -e 'my $keys = 0; for %*VM.kv -> $k, $v { $keys++}; say $keys'
  1

I'll pass this back to moritz++ to decide if this needs a spectest to
close the ticket.

Pm

@p6rt
Copy link
Author

p6rt commented Jul 1, 2009

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

@p6rt
Copy link
Author

p6rt commented Sep 26, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/integration/real-strings.t

commit d975206783869d325cafb191330f961bc32019ac
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sat Sep 26 16​:38​:51 2009 +0000

  [t/spec] test for RT #​66818, %*VM behaving weirdly
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;28421 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/integration/real-strings.t b/t/spec/integration/real-strings.t
index a89f237..5b14597 100644
--- a/t/spec/integration/real-strings.t
+++ b/t/spec/integration/real-strings.t
@@ -1,6 +1,6 @@
 use v6;
 use Test;
-plan 10;
+plan 11;
 
 # Rakudo had a regression that
 # string returned from regexes were Parrot strings, not Perl 6 strings.
@@ -48,4 +48,12 @@ is "helo".lc.trans(("aeiou" => "AEIOU")),   'hElO', '.flip.trans (RT 66300)';
     is substtest("mop"), "map", '.subst works in a multi';
 }
 
+# not a "real string', but a "real hash" bug found in Rakudo:
+
+{
+    my $x = 0;
+    for %*VM.kv -> $k, $v { $x++};
+    is $x, +%*VM.keys, '%*VM.kv is self-consistent';
+}
+
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Sep 26, 2009

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

@p6rt p6rt closed this as completed Sep 26, 2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant