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

Autovivifying .push on doesn't mesh well with typed containers in Rakudo #3406

Closed
p6rt opened this issue Jun 3, 2014 · 4 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 3, 2014

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

Searchable as RT122028$

@p6rt
Copy link
Author

p6rt commented Jun 3, 2014

From @masak

<masak> m​: class D {}; my Array[D] %ds; %ds<bar>.push​: D.new # golf'd
<camelia> rakudo-moar 17f023​: OUTPUT«Type check failed in assignment
to '%ds'; expected 'Array[D]' but got 'Array'␤ in method push [...]»
<masak> as far as I can understand, the above fails because the
auto-vivification helpfully creates an Array for me.
<masak> and that Array is not an Array[D], so the typecheck fails.
* masak submits rakudobug
<jnthn> m​: class D {}; my Array[D] %ds; say %ds<bar>
<camelia> rakudo-moar 17f023​: OUTPUT«(Array[D])␤»
<jnthn> Ah, good, so we do know the type...

@p6rt
Copy link
Author

p6rt commented Aug 16, 2014

From @perlpilot

On Tue Jun 03 08​:27​:31 2014, masak wrote​:

<masak> m​: class D {}; my Array[D] %ds; %ds<bar>.push​: D.new # golf'd
<camelia> rakudo-moar 17f023​: OUTPUT«Type check failed in assignment
to '%ds'; expected 'Array[D]' but got 'Array'␤ in method push [...]»
<masak> as far as I can understand, the above fails because the
auto-vivification helpfully creates an Array for me.
<masak> and that Array is not an Array[D], so the typecheck fails.
* masak submits rakudobug
<jnthn> m​: class D {}; my Array[D] %ds; say %ds<bar>
<camelia> rakudo-moar 17f023​: OUTPUT«(Array[D])␤»
<jnthn> Ah, good, so we do know the type...

See rakudo/rakudo@5bb3a03

-Scott

@p6rt
Copy link
Author

p6rt commented Aug 16, 2014

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

@p6rt
Copy link
Author

p6rt commented Aug 16, 2014

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

@p6rt p6rt closed this as completed Aug 16, 2014
@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