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

sub &prefix:<[~]> is being unexpectedly hidden by class definition. #1771

Closed
p6rt opened this issue May 21, 2010 · 5 comments
Closed

sub &prefix:<[~]> is being unexpectedly hidden by class definition. #1771

p6rt opened this issue May 21, 2010 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented May 21, 2010

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

Searchable as RT75234$

@p6rt
Copy link
Author

p6rt commented May 21, 2010

From @finanalyst

On its own, class B executes as expectedly​:

class B {method n { return [~] gather for ^4 {.say;take 'b'}}};my B
$x.=new; say $x.n
0
1
2
3
bbbb

When another class using reduction ~ is in front of it, even if it is
not executed, B fails.

class A {method m { return [] gather for ^3 {take 'a'}}};class B
{method n { return [
] gather for ^4 {.say;take 'b'}}};my B $x.=new; say
$x.n
Could not find sub &prefix​:<[~]>

@p6rt
Copy link
Author

p6rt commented May 22, 2010

From @jnthn

On Thu May 20 22​:07​:16 2010, richardh wrote​:

On its own, class B executes as expectedly​:

class B {method n { return [~] gather for ^4 {.say;take 'b'}}};my B
$x.=new; say $x.n
0
1
2
3
bbbb

When another class using reduction ~ is in front of it, even if it is
not executed, B fails.

class A {method m { return [] gather for ^3 {take 'a'}}};class B
{method n { return [
] gather for ^4 {.say;take 'b'}}};my B $x.=new; say
$x.n
Could not find sub &prefix​:<[~]>

Fixed now​:

class A {method m { return [] gather for ^3 {take 'a'}}}; class B
{method n { return [
] gather for ^4 {.say;take 'b'}}};my B $x.=new; say
$x.n
0
1
2
3
bbbb

Given to moritz++ for spectest coverage.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented May 22, 2010

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

@p6rt
Copy link
Author

p6rt commented May 24, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S03-metaops/reduce.t

commit 80cda339998f067ff095ec9e3ffbfcd3093ca367
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Mon May 24 11​:01​:59 2010 +0000

  [t/spec] tests for RT #​75234, using a metaop in one class hides it from a second class
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;30771 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S03-metaops/reduce.t b/t/spec/S03-metaops/reduce.t
index 1a0de91..f3d2c4e 100644
--- a/t/spec/S03-metaops/reduce.t
+++ b/t/spec/S03-metaops/reduce.t
@@ -1,7 +1,7 @@
 use v6;
 use Test;
 
-plan 83;
+plan 86;
 
 =begin pod
 
@@ -210,4 +210,20 @@ is( ([\R~] 'a'..*).batch(8).join(', '), 'a, ba, cba, dcba, edcba, fedcba, gfedcb
     is [^^](0, 0, 17), (0 ^^ 0 ^^ 17), '[^^] mix 6';
 }
 
+# RT #75234
+# rakudo had a problem where once-used meta operators weren't installed
+# in a sufficiently global location, so using a meta operator in class once
+# makes it unusable further on
+{
+    class A {
+        method m { return [~] gather for ^3 {take 'a'} }
+    }
+    class B {
+        method n { return [~] gather for ^4 {take 'b'}}
+    }
+    is A.new.m, 'aaa',  '[~] works in first class';
+    is B.new.n, 'bbbb', '[~] works in second class';
+    is ([~] 1, 2, 5), '125', '[~] works outside class';
+}
+
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented May 24, 2010

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

@p6rt p6rt closed this as completed May 24, 2010
@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