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



If a module explicitly uses a symbol as a namespace, it cannot export a class 
or role as that symbol name.

$ cat > /tmp/f1.pm6
module f1 {
class A::B { }
class A is export { }
}
$ PERL6LIB=/tmp perl6 -e "use f1"
===SORRY!=== Error while compiling -e
Cannot import symbol A from f1, because it already exists in this lexical scope
at -e:1
------> use f1⏏<EOL>
$ cat > /tmp/f1.pm6
module f1 {
my $A::B;
class A is export { }
}
$ PERL6LIB=/tmp perl6 -e "use f1"
===SORRY!=== Error while compiling -e
Cannot import symbol A from f1, because it already exists in this lexical scope
at -e:1
------> use f1⏏<EOL>

This appears to be due to the namespace symbol being imported even though 
nothing in it exports...

$ cat /tmp/f1.pm6
module f1 {
my $A::B = 42
}
$ PERL6LIB=/tmp perl6 -e "use f1; say ::(A)"
Use of uninitialized value of type A in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something 
meaningful.
  in block <unit> at -e line 1
No such symbol ''
  in block <unit> at -e line 1

Actually thrown at:
  in block <unit> at -e line 1

$ PERL6LIB=/tmp perl6 -e "say ::(A)"
===SORRY!=== Error while compiling -e
Undeclared name:
    A used at line 1


(I think this is a newish behavior but couldn't figure out how to get 
bisectable to handle a precomp)

Reply via email to