use v6;
use Test;
plan 6;
eval_lives_ok 'my $x; my $x',
'it is legal to declare my $x twice in the same scope.';
eval_lives_ok 'state $x; state $x',
'it is legal to declare state $x twice in the same scope.';
{
my $x = 2;
my $y := $x;
my $x = 3;
is $y, 3, 'Two lexicals with the name in same scope are the same variable';
}
eval_dies_ok 'sub foo {1; }; sub foo($x) {1; };',
'multiple declarations need multi or proto';
eval_dies_ok 'only sub foo {1; }; sub foo($x) {1; };',
'multiple declarations need multi or proto';
eval_lives_ok 'proto foo {1; }; sub foo {1; }; sub foo($x) {1; };',
'multiple declarations need multi or proto';