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

outer declaration of package/module/class disturbs namespace #5537

Open
p6rt opened this issue Aug 5, 2016 · 1 comment
Open

outer declaration of package/module/class disturbs namespace #5537

p6rt opened this issue Aug 5, 2016 · 1 comment

Comments

@p6rt
Copy link

p6rt commented Aug 5, 2016

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

Searchable as RT128854$

@p6rt
Copy link
Author

p6rt commented Aug 5, 2016

From @MARTIMM

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

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