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

return() resets named arguments #1764

Closed
p6rt opened this issue May 15, 2010 · 6 comments
Closed

return() resets named arguments #1764

p6rt opened this issue May 15, 2010 · 6 comments

Comments

@p6rt
Copy link

p6rt commented May 15, 2010

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

Searchable as RT75118$

@p6rt
Copy link
Author

p6rt commented May 15, 2010

From @moritz

15​:18 <@​moritz_> rakudo​: sub foo() { return 1,2,​:c<3> }; say foo().perl
15​:18 <+p6eval> rakudo 16e953​: OUTPUT«(1, 2, "c" => Any)␤»

@p6rt
Copy link
Author

p6rt commented May 15, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in at least one of these files​: misc/helpnow/README, t/spec/S06-advanced_subroutine_features/return.t

commit d98dc61c3112db38ac492c0df797d66e735d43da
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sat May 15 13​:29​:29 2010 +0000

  [t/spec] tests for RT #​75118, named arguments to return()
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;30644 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/misc/helpnow/README b/misc/helpnow/README
index f2714ea..882e333 100644
--- a/misc/helpnow/README
+++ b/misc/helpnow/README
@@ -21,6 +21,8 @@ Perl 6 that's achievable for a newcomer.
 
     Port a smallish module
         - Log::Message
+        - Text::Wrap
+        - Text::Soundex (but wait until Str.trans is implemented)
 
     Implement $smallish_feature in $implementation
 
diff --git a/t/spec/S06-advanced_subroutine_features/return.t b/t/spec/S06-advanced_subroutine_features/return.t
index 4fe6797..ead6cb8 100644
--- a/t/spec/S06-advanced_subroutine_features/return.t
+++ b/t/spec/S06-advanced_subroutine_features/return.t
@@ -15,7 +15,7 @@ See also t/blocks/return.t, which overlaps in scope.
 # reference for the spec for 'return', but I couldn't find
 # one either. 
 
-plan 73;
+plan 76;
 
 # These test the returning of values from a subroutine.
 # We test each data-type with 4 different styles of return.
@@ -300,6 +300,17 @@ is Foo.new.officialsubmeth(), 43,
 is Foo::official(), 44,
     "return correctly from official sub only";
 
+# RT #75118
+{
+    sub named() {
+        return 1, 2, :c(3);
+    }
+    is named().elems, 3,       'return with named arguments';
+    is named().[2].key, 'c',   ' ... correct key';
+    #?rakudo todo 'named argument to return()'
+    is named().[2].value, '3', ' ... correct value';
+}
+
 # RT #61732
 {
     sub rt61732_c { 1; CATCH {} }

@p6rt
Copy link
Author

p6rt commented May 15, 2010

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

@p6rt
Copy link
Author

p6rt commented Oct 1, 2011

From @coke

On Sat May 15 06​:21​:47 2010, moritz wrote​:

15​:18 <@​moritz_> rakudo​: sub foo() { return 1,2,​:c<3> }; say foo().perl
15​:18 <+p6eval> rakudo 16e953​: OUTPUT«(1, 2, "c" => Any)␤»

Still wrong, but updated​:

$ ./perl6 -e 'sub foo() { return 1,2,​:c<3> }; say foo().perl'
(1, 2, "c" => Mu)

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Sep 19, 2015

From @niner

This was fixed by Rakudo commit 0d40e00

perl6 -e 'sub foo() { return 1,2,​:c<3> }; say foo().perl'
(1, 2, :c(IntStr.new(3, "3")))

@p6rt
Copy link
Author

p6rt commented Sep 19, 2015

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

@p6rt p6rt closed this as completed Sep 19, 2015
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

1 participant