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

Scalars never give up their container type #342

Closed
p6rt opened this issue Sep 26, 2008 · 4 comments
Closed

Scalars never give up their container type #342

p6rt opened this issue Sep 26, 2008 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 26, 2008

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

Searchable as RT59382$

@p6rt
Copy link
Author

p6rt commented Sep 26, 2008

From @moritz

22​:35 < moritz_> rakudo​: my $a = { a => 42 }; say 1; $a = [ 0 ]; say 2
22​:35 < p6eval> rakudo 31446​: OUTPUT[1␤Odd number of elements found
where hash
  expected␤current instr.​: 'parrot;List;hash' pc 2877
  (src/gen_builtins.pir​:1999)␤]
22​:38 < moritz_> rakudo​: my $a = [0]; say 1; $a = 2; say $a.WHAT
22​:38 < p6eval> rakudo 31446​: OUTPUT[1␤Array␤]

When a scalar variable holds either an array or or a hash, assigning to
it always forces the LHS into the type of the previous container.

There's a test for that in
t/spec/S02-builtin_data_types/catch_type_cast_mismatch.t which I'll add
to spectest_regression soon.

--
Moritz Lenz
http://perlgeek.de/ | http://perl-6.de/ | http://sudokugarden.de/

@p6rt
Copy link
Author

p6rt commented Nov 7, 2008

From @pmichaud

Now fixed in r32441​:

$ ./parrot perl6.pbc

my $a = { a => 42 }; say 1; $a = [ 0 ]; say 2;
1
2
my $a = [ 0 ]; say 1; $a = 2; say $a.WHAT;
1
Int

@p6rt
Copy link
Author

p6rt commented Nov 7, 2008

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

@p6rt
Copy link
Author

p6rt commented Nov 7, 2008

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

@p6rt p6rt closed this as completed Nov 7, 2008
@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