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

Returning from a parameter list default counts as returning 'outside of any Routine' in Rakudo on Moar #3453

Closed
p6rt opened this issue Jul 20, 2014 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jul 20, 2014

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

Searchable as RT122345$

@p6rt
Copy link
Author

p6rt commented Jul 20, 2014

From @masak

< masak> r​: sub { sub foo($x = return) { $x }; say foo }(); say "alive"
<camelia> rakudo-jvm bbdcfd​: OUTPUT«alive␤»
<camelia> ..rakudo-moar bbdcfd​: OUTPUT«Attempt to return outside of
any Routine [...]
<camelia> ..rakudo-parrot bbdcfd​: OUTPUT«alive␤Nominal type check
failed for parameter '$x'; expected Any but got Mu instead␤»
<masak> hey, but that's a moarbug right there...
* masak submits moarbug

rakudo-jvm has this one right. rakudo-parrot fails because of another
known effect, reported in RT #​122325. rakudo-moar seems to be under
the impression that the parameter list isn't part of the routine. But
it is; at the point the parameters bind, we're already "running" the
routine, and should be able to return from it.

@p6rt
Copy link
Author

p6rt commented Sep 10, 2017

From @smls

On Sun, 20 Jul 2014 10​:29​:57 -0700, masak wrote​:

< masak> r​: sub { sub foo($x = return) { $x }; say foo }(); say "alive"
<camelia> rakudo-jvm bbdcfd​: OUTPUT«alive␤»
<camelia> ..rakudo-moar bbdcfd​: OUTPUT«Attempt to return outside of
any Routine [...]
<camelia> ..rakudo-parrot bbdcfd​: OUTPUT«alive␤Nominal type check
failed for parameter '$x'; expected Any but got Mu instead␤»

This works now with Rakudo MoarVM as well.

  ➜ sub { sub foo($x = return) { $x }; say foo }(); say "alive";
  alive

bisectable6 reports¹ that it was fixed by one of these commits​:

  rakudo/rakudo@e609822
  rakudo/rakudo@615d30c
  rakudo/rakudo@8beb87b
  rakudo/rakudo@05170e0
  rakudo/rakudo@899e0fd
  rakudo/rakudo@e544376
  rakudo/rakudo@fcd0093
  rakudo/rakudo@04929fe
  rakudo/rakudo@7ee6578
  rakudo/rakudo@519e764

Ticket can be closed with tests.


[1] https://gist.github.com/Whateverable/7807d6ff7d2e1d059172c7cb784bd4d7

@p6rt
Copy link
Author

p6rt commented Sep 10, 2017

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

@p6rt
Copy link
Author

p6rt commented Oct 13, 2017

From @zoffixznet

Tests​: Raku/roast@809abcd5a7

@p6rt p6rt closed this as completed Oct 13, 2017
@p6rt
Copy link
Author

p6rt commented Oct 13, 2017

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

@p6rt p6rt added the testneeded label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant