Skip to content

Commit

Permalink
RT #125371, catch variable use in its own initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
FROGGS committed Aug 17, 2015
1 parent b4780f5 commit cddf3a2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion S02-names-vars/variables-and-packages.t
Expand Up @@ -166,7 +166,7 @@ plan 38;
my @array;
for 1..3 {
@array.push($i);
my $i = 1 + $i;
my $i = 1;
}
};
s(9);/ },
Expand Down
7 changes: 2 additions & 5 deletions S04-declarations/my.t
Expand Up @@ -159,11 +159,8 @@ is(EVAL('loop (my $x = 1, my $y = 2; $x > 0; $x--) { last }; $y #OK'), 2, '2nd m
is($f, 5, "two lexicals declared in scope is noop");
}

my $z = 42; #OK not used
{
my $z = $z;
nok( $z.defined, 'my $z = $z; can not see the value of the outer $z');
}
# RT #125371
throws-like 'my $z = $z', X::Syntax::Variable::Initializer, name => '$z';

# interaction of my and EVAL
# yes, it's weird... but that's the way it is
Expand Down
8 changes: 1 addition & 7 deletions S04-declarations/our.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 32;
plan 31;

# L<S04/The Relationship of Blocks and Declarations/"our $foo" introduces a lexically scoped alias>
our $a = 1;
Expand Down Expand Up @@ -31,12 +31,6 @@ is($a, 3, '$a has changed'); # XXX is that right?
is ~@b, '3', 'push actually worked on @b';
}

our $c = 42; #OK not used
{
my $c = $c;
nok( $c.defined, 'my $c = $c; can not see the value of the outer $c');
}

# check that our-scoped variables really belong to the package
{
package D1 {
Expand Down
2 changes: 1 addition & 1 deletion S14-roles/mixin.t
Expand Up @@ -128,7 +128,7 @@ is $y.test, 42, 'method from other role was OK too';
my $rt115390 = 0;
for 1..1000 -> $i {
$rt115390 += $i.perl;
my $error = (my $val = (^10).pick(3).min but !$val);
my $error = (my $val = (^10).pick(3).min but !$rt115390);
1
}
is $rt115390, 500500,
Expand Down

0 comments on commit cddf3a2

Please sign in to comment.