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

Rakudo disallows methods with a legal reference to @_ in them #1523

Closed
p6rt opened this issue Feb 19, 2010 · 4 comments
Closed

Rakudo disallows methods with a legal reference to @_ in them #1523

p6rt opened this issue Feb 19, 2010 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Feb 19, 2010

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

Searchable as RT72940$

@p6rt
Copy link
Author

p6rt commented Feb 19, 2010

From @masak

<masak> rakudo​: class X {method x (*@​_) {say @​_} }; X.new.x(5)
<p6eval> rakudo 3704a2​: OUTPUT«Placeholder variables cannot be used in
a method [...]
<masak> whoz op with that?
<moritz_> b0rkaged
<jnthn> masak​: Probably it's being a bit over-eager.
<moritz_> rakudo​: class X {method x {say @​_} }; X.new.x(5)
<p6eval> rakudo 3704a2​: OUTPUT«Placeholder variables cannot be used in
a method [...]
<jnthn> masak​: The "we has @​_ and we're in a method so cry" check
probably wants to also check "is @​_ defined already".
<jnthn> And not worry about it if so.
* masak submits rakudobug
<masak> quietfanatic++ for discovering it

@p6rt
Copy link
Author

p6rt commented May 8, 2010

From @moritz

fixed by jnthn++

@p6rt
Copy link
Author

p6rt commented May 8, 2010

@moritz - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed May 8, 2010
@p6rt
Copy link
Author

p6rt commented May 8, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S12-methods/instance.t

commit af093547fb0e2b08548fada0958b881a778e8b50
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sat May 8 10​:45​:48 2010 +0000

  [t/spec] test for RT #​72940, *@​_ in method signature
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;30588 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S12-methods/instance.t b/t/spec/S12-methods/instance.t
index efcc6cc..fd9610b 100644
--- a/t/spec/S12-methods/instance.t
+++ b/t/spec/S12-methods/instance.t
@@ -2,7 +2,7 @@ use v6;
 
 use Test;
 
-plan 31;
+plan 32;
 
 =begin pod
 
@@ -183,4 +183,13 @@ is AnonInvocant.new().me, AnonInvocant, 'a typed $: as invocant is OK';
     is $tracker, 5, ' ... and got right result (implicit)';
 }
 
+# RT #72940
+{
+    class X {
+        method x(*@_) { @_[0] };
+    }
+    is X.new.x('5'), '5', 'can use explicit @_ in method signature';
+
+}
+
 # vim: ft=perl6

@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