# New Ticket Created by  Paul Cochrane 
# Please include the string:  [perl #130424]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=130424 >


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
https://github.com/perl6-community-modules/p6-test-builder/pull/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

Reply via email to