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 doesn't allow inheriting from classes with :: in the name #388
Comments
From @masak<masak> rakudo: class A {}; class C is A {}; say "OH HAI" |
From @moritzOn Wed Nov 05 13:42:51 2008, masak wrote:
Added (skipped) tests for that to t/spec/S12-class/inheritance.t in pugs |
The RT System itself - Status changed from 'new' to 'open' |
From @chrisdolanOn Wed Nov 05 13:54:02 2008, moritz wrote:
I did ./perl6 --target=pir -e 'class A::B {}; class A::B::C is A::B {}' > Then I hacked the PIR to get it to work. Here's the PIR diff that Inline Patch--- 60356.pir~ 2008-11-05 21:36:54.000000000 -0600
+++ 60356.pir 2008-11-05 21:40:08.000000000 -0600
@@ -37,7 +37,7 @@
$P15."register"($P16, "Any" :named("parent"))
$P17 = "!keyword_class"("A::B::C")
store_lex "$def", $P17
- get_global $P18, "A::B"
+ get_global $P18, ["A"],"B"
unless_null $P18, vivify_10
new $P18, "Undef"
vivify_10: |
From @chrisdolan... and here's a patch to Rakudo's actions.pm to implement the fix. I I haven't figured out the spec tests yet, so I only tested with the ./perl6 -e 'class A::B { method foo { say "Foo"; } }; class A::B::C is |
From @chrisdolanRT#60356.patchIndex: languages/perl6/src/parser/actions.pm
===================================================================
--- languages/perl6/src/parser/actions.pm (revision 32369)
+++ languages/perl6/src/parser/actions.pm (working copy)
@@ -1453,16 +1453,22 @@
my $aux := $_<trait_auxiliary>;
# Apply any "is" traits through MMD.
if $aux<sym> eq 'is' {
+ my @identifier := Perl6::Compiler.parse_name(~$aux<name>);
+ my $name := @identifier.pop();
+ my $superclass := PAST::Var.new(
+ :name($name),
+ :scope('package'),
+ :viviself('Undef')
+ );
+ if +@identifier != 0 {
+ $superclass.namespace(@identifier);
+ }
$package.push(
PAST::Op.new(
:pasttype('call'),
:name('trait_auxiliary:is'),
+ $superclass,
- PAST::Var.new(
- :name(~$aux<name>),
- :scope('package'),
- :viviself('Undef')
- ),
PAST::Var.new(
:name('$def'),
:scope('lexical')
)
|
From @jnthnOn Wed Nov 05 21:38:15 2008, chrisdolan wrote:
Looks to be pretty much what I'd have done myself, for what that counts
Thanks, Jonathan |
@jnthn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#60356 (status was 'resolved')
Searchable as RT60356$
The text was updated successfully, but these errors were encountered: