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


Hi,

Got the following error

Type 'M0::C1' is not declared
at /home/marcel/Languages/Perl6/Tests/Class/moc1.pl6:8
------>   has M0::C1⏏ $!c1;
Malformed has
at /home/marcel/Languages/Perl6/Tests/Class/moc1.pl6:8
------>   has M0::⏏C1 $!c1;

from the following code;
The program m0c1.pl6

#!/usr/bin/env perl6

use v6.c;
use M0::C1;

class xyz {   # same for package and module
   class M0 {
     has M0::C1 $!c1;
   }
}

my $c1 = xyz::M0.new;


and the file M0/C1.pm6

use v6.c;
class M0::C1 {}


Error disappears when outer class(xyz) is removed and 'my $c1 = 
xyz::M0.new;' is changed into
'my $c1 = M0.new;'

As an alternative the error also disappears when renaming the inner 
class into Mx0 and change 'my $c1 = xyz::M0.new;' into 'my $c1 = 
xyz::Mx0.new;'.

And this one helps too and is maybe the recommended way to do; rewrite 
'has M0::C1 $!c1;' into 'has ::M0::C1 $!c1;'.

So 1) the message is not helpful and 2) it doesn't show a consequent 
behavior if I look at the last two workarounds.

Greetings,
Marcel

Reply via email to