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

repeated part in full class name causes role to be undeclared in compilation #5923

Open
p6rt opened this issue Dec 28, 2016 · 1 comment
Open
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 28, 2016

Migrated from rt.perl.org#130424 (status was 'new')

Searchable as RT130424$

@p6rt
Copy link
Author

p6rt commented Dec 28, 2016

From paul@liekut.de

Hi,

it seems to be the case that when part of a full class name is repeated,
that roles in subclasses are reported as undeclared during compilation.
This issue showed up recently in Test​::Builder where the word 'Test' appears
twice in the full class name (Test​::Builder​::Test). See
raku-community-modules/Test-Builder#5 for more
information. The issue first turned up in Rakudo commit
ab946945735042ff99953f6636bdf98acd5bfc71.

@​ugexe managed to golf the problem to the following​:

Works​: perl6 -e 'class A​::B​::A { }; role A​::B​::C { }; class A​::B { has A​::B​::C $!x; };'
Fails​: perl6 -e '{ class A​::B​::A { }; }; role A​::B​::C { }; class A​::B { has A​::B​::C $!x; };'
Works​: perl6 -e '{ class A​::B​::X { }; }; role A​::B​::C { }; class A​::B { has A​::B​::C $!x; };'

where 'Works' gives no output and 'Fails' reports the following error
message​:

===SORRY!===
Type 'A​::B​::C' is not declared
------> le A​::B​::C { }; class A​::B { has A​::B​::C⏏ $!foo; };
Malformed has
------> ole A​::B​::C { }; class A​::B { has A​::B​::⏏C $!foo; };

Note that only when at least the third part of the full class name is
repeated that this issue occurs. If the second part is repeated, the issue
does not appear, e.g.,

perl6 -e '{ class A​::A​::X { }; }; role A​::A​::C { }; class A​::A { has A​::A​::C $!x; };'

compiles as expected.

Cheers,

Paul

@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