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 lets you define a sub over an enum value if you do it in an eval #782

Closed
p6rt opened this issue Mar 14, 2009 · 5 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Mar 14, 2009

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

Searchable as RT63882$

@p6rt
Copy link
Author

p6rt commented Mar 14, 2009

From @masak

<bacek> rakudo​: enum A <a>; say a; eval 'sub a { "O HI" }'; say a
<p6eval> rakudo 5b1ff9​: OUTPUT«0␤a␤»
<bacek> what???
<jnthn> bwaha
<jnthn> I know *why* but it's wrong. :-)
<masak> indeed.
<jnthn> (Should not let you define that sub...)
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Jul 27, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S02-names/our.t

commit d176c5c8b7b9b5d92ed952f701ed2d740a5610e0
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Mon Jul 27 19​:57​:31 2009 +0000

  [t/spec] Test for RT #​63882
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;27760 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S02-names/our.t b/t/spec/S02-names/our.t
index db8de18..1627adc 100644
--- a/t/spec/S02-names/our.t
+++ b/t/spec/S02-names/our.t
@@ -1,7 +1,7 @@
 use v6;
 use Test;
 
-plan 3;
+plan 7;
 
 # L<S02/Names/Symbols in the current package>
 
@@ -13,3 +13,15 @@ plan 3;
     #?rakudo skip 'Null PMC access in invoke()'
     is OUR::eval_born(), 5, 'call to eval-born sub works';
 }
+
+# RT #63882
+{
+    enum A <a b c>;
+    is c, 2, 'c is 2 from enum';
+    eval 'sub c { "sub c" }';
+    ok  $!  !~~ Exception, 'can define sub c in eval after c defined in enum';
+    #?rakudo todo 'sub in eval shadows enum'
+    is c, 2, 'c is still 2 from enum';
+    #?rakudo skip 'OUR::subname() does not work'
+    is OUR::c(), 'sub c', 'sub c called with OUR:: works';
+}

@p6rt
Copy link
Author

p6rt commented Jul 27, 2009

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

@p6rt
Copy link
Author

p6rt commented Sep 30, 2011

From @moritz

The relevant tests pass now, closing ticket.

@p6rt
Copy link
Author

p6rt commented Sep 30, 2011

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

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