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

Hyper method call on typed Array returns "impossible" result #6254

Open
p6rt opened this issue May 20, 2017 · 4 comments
Open

Hyper method call on typed Array returns "impossible" result #6254

p6rt opened this issue May 20, 2017 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented May 20, 2017

Migrated from rt.perl.org#131332 (status was 'open')

Searchable as RT131332$

@p6rt
Copy link
Author

p6rt commented May 20, 2017

From @zoffixznet

By hypering a method on an Array typed with Pair containing Pairs, it magically turns into a typed Pair Array containing Str objects, which would normally fail the type check​:

m​: my Pair @​p = a => 1, b => 2; dd @​p».key
rakudo-moar 316399​: OUTPUT​: «Array[Pair].new("a", "b")␤»

@p6rt
Copy link
Author

p6rt commented May 20, 2017

From @lizmat

On 20 May 2017, at 13​:05, Zoffix Znet (via RT) <perl6-bugs-followup@​perl.org> wrote​:

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

By hypering a method on an Array typed with Pair containing Pairs, it magically turns into a typed Pair Array containing Str objects, which would normally fail the type check​:

m​: my Pair @​p = a => 1, b => 2; dd @​p».key
rakudo-moar 316399​: OUTPUT​: «Array[Pair].new("a", "b")␤»

Shouldn’t this like, eh, return a .Seq ??

@p6rt
Copy link
Author

p6rt commented May 20, 2017

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

@p6rt p6rt added the Bug label Jan 5, 2020
@raiph
Copy link

raiph commented Aug 22, 2021

Was this just you both getting confused?

say $*RAKU.compiler.version; # v2021.02.1

my Pair @p = a => 1, b => 2;
dd @p;       # Array[Pair] @p = Array[Pair].new("a" => 1, "b" => 2)
dd @p».key;  # Array[Pair].new("a", "b")
say @p;      # [a => 1 b => 2]
say @p».key; # [a b]

What's the problem?

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

2 participants