Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote branch 'origin/outer-bound' into nom

  • Loading branch information...
commit 3c3f780f8b45415242cc679f93a89f4eb0d621c3 2 parents f6ee0c9 + 0199241
@moritz moritz authored
Showing with 17 additions and 2 deletions.
  1. +8 −2 src/Perl6/Actions.pm
  2. +9 −0 src/core/Exception.pm
View
10 src/Perl6/Actions.pm
@@ -1702,8 +1702,14 @@ class Perl6::Actions is HLL::Actions does STDActions {
my $sigil := $<variable><sigil>;
my $twigil := $<variable><twigil>[0];
my $name := ~$sigil ~ ~$twigil ~ ~$<variable><desigilname>;
- if $<variable><desigilname> && $*W.cur_lexpad().symbol($name) {
- $/.CURSOR.typed_worry('X::Redeclaration', symbol => $name);
+ if $<variable><desigilname> {
+ my $lex := $*W.cur_lexpad();
+ if $lex.symbol($name) {
+ $/.CURSOR.typed_worry('X::Redeclaration', symbol => $name);
+ }
+ elsif $lex<also_uses> && $lex<also_uses>{$name} {
+ $/.CURSOR.typed_sorry('X::Redeclaration::Outer', symbol => $name);
+ }
}
make declare_variable($/, $past, ~$sigil, ~$twigil, ~$<variable><desigilname>, $<trait>, $<semilist>);
}
View
9 src/core/Exception.pm
@@ -521,6 +521,15 @@ my class X::Redeclaration does X::Comp {
}
}
+my class X::Redeclaration::Outer does X::Comp {
+ has $.symbol;
+ method message() {
+ "Lexical symbol '$.symbol' is already bound to an outer symbol;\n" ~
+ "the implicit outer binding must be rewritten as OUTER::<$.symbol>\n" ~
+ "before you can unambiguously declare a new '$.symbol' in this scope";
+ }
+}
+
my class X::Import::Redeclaration does X::Comp {
has @.symbols;
has $.source-package-name;
Please sign in to comment.
Something went wrong with that request. Please try again.