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

.pick and .roll return incorrect results for object hashes #6585

Closed
p6rt opened this issue Oct 8, 2017 · 5 comments
Closed

.pick and .roll return incorrect results for object hashes #6585

p6rt opened this issue Oct 8, 2017 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Oct 8, 2017

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

Searchable as RT132246$

@p6rt
Copy link
Author

p6rt commented Oct 8, 2017

From p.dumarchie@gmail.com

This is Rakudo version 2017.07 built on MoarVM version 2017.07
implementing Perl 6.c.

For regular hashes the methods .pick and .roll return the expected results​:

use Test;
Nil;
my %str = question => 42;
{question => 42}
is %str.pick, %str.pairs.pick;
ok 1 -
True
is %str.roll, %str.pairs.roll;
ok 2 -
True

But these methods appear to be unaware of the object hash abstraction​:

my %obj{Any} = question => 42;
{question => 42}
is %obj.pick, %obj.pairs.pick;
not ok 3 -

# Failed test at <unknown file> line 1
# expected​: 'question 42'
# got​: 'Str|question question 42'
False

is %obj.roll, %obj.pairs.roll;
not ok 4 -

# Failed test at <unknown file> line 1
# expected​: 'question 42'
# got​: 'Str|question question 42'
False

@p6rt
Copy link
Author

p6rt commented Oct 8, 2017

From @lizmat

Fixed with 12fcece494e12b , tests needed

On 8 Oct 2017, at 13​:18, Peter du Marchie van Voorthuysen (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Peter du Marchie van Voorthuysen
# Please include the string​: [perl #​132246]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=132246 >

This is Rakudo version 2017.07 built on MoarVM version 2017.07
implementing Perl 6.c.

For regular hashes the methods .pick and .roll return the expected results​:

use Test;
Nil;
my %str = question => 42;
{question => 42}
is %str.pick, %str.pairs.pick;
ok 1 -
True
is %str.roll, %str.pairs.roll;
ok 2 -
True

But these methods appear to be unaware of the object hash abstraction​:

my %obj{Any} = question => 42;
{question => 42}
is %obj.pick, %obj.pairs.pick;
not ok 3 -

# Failed test at <unknown file> line 1
# expected​: 'question 42'
# got​: 'Str|question question 42'
False

is %obj.roll, %obj.pairs.roll;
not ok 4 -

# Failed test at <unknown file> line 1
# expected​: 'question 42'
# got​: 'Str|question question 42'
False

@p6rt
Copy link
Author

p6rt commented Oct 8, 2017

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

@p6rt
Copy link
Author

p6rt commented Feb 9, 2018

From @zoffixznet

Test​: Raku/roast@7bd36fc9387de575c

@p6rt p6rt closed this as completed Feb 9, 2018
@p6rt
Copy link
Author

p6rt commented Feb 9, 2018

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

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