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

Shaped array in signatures doesn't declare the lexical variable #5011

Closed
p6rt opened this issue Jan 7, 2016 · 2 comments
Closed

Shaped array in signatures doesn't declare the lexical variable #5011

p6rt opened this issue Jan 7, 2016 · 2 comments

Comments

@p6rt
Copy link

p6rt commented Jan 7, 2016

Migrated from rt.perl.org#127195 (status was 'new')

Searchable as RT127195$

@p6rt
Copy link
Author

p6rt commented Jan 7, 2016

From @Juerd

Works​:

  sub foo (@​bar[4]) { say "can haz bar" };

  my @​x[4]; foo(@​x); # outputs "can haz bar"
  my @​y[5]; foo(@​y); # "Constraint type check failed ..."

Doesn't compile​:

  sub foo (@​bar[4]) { say "can haz bar​: @​bar[]" };
  # "Variable '@​bar' is not declared"

Does the wrong thing​:

  my @​bar = <outer scope>;
  sub foo (@​bar[4]) { say "can haz bar​: @​bar[]" };

  my @​x[4]; foo(@​x); # outputs "outer scope"

--
Met vriendelijke groet, // Kind regards, // Korajn salutojn,

Juerd Waalboer <juerd@​tnx.nl>
TNX

@usev6
Copy link

usev6 commented Oct 14, 2023

This works now:

$ ./rakudo-m -e 'sub foo (@bar[2]) { say "can haz bar: @bar[]" }; my @x[2] = [1,2,3;4,5,6]; foo(@x)'
can haz bar: 1 2 3 4 5 6

According to bisectable6 (https://colabti.org/irclogger/irclogger_log/raku-dev?date=2023-10-14#l176) this has been fixed with rakudo/rakudo@ca78390ecc.

The issue mentioned in that commit (rakudo/rakudo#3314) describes the same problem.

We also have a test in roast (added with Raku/roast@ecdf550c86), so I'm closing this issue as "resolved".

@usev6 usev6 closed this as completed Oct 14, 2023
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

2 participants