Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b2c8ad2728
Fetching contributors…

Cannot retrieve contributors at this time

file 37 lines (29 sloc) 1.048 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
use v6;
use Test;
plan 6;

# L<S04/The Relationship of Blocks and Declarations/"If you declare a lexical
# twice in the same scope">

#?rakudo todo "is this catching the warning?"
eval_lives_ok 'my $x; my $x',
              'it is legal to declare my $x twice in the same scope.';

#?rakudo todo 'nom regression'
eval_lives_ok 'state $x; state $x',
              'it is legal to declare state $x twice in the same scope.';

#?rakudo skip 'binding'
{
    my $x = 2;
    my $y := $x;
    my $x = 3;
    is $y, 3, 'Two lexicals with the name in same scope are the same variable';
}

# this is not exactly S04 material
#?pugs todo
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';

#?niecza todo "MMD"
#?rakudo todo 'nom regression'
eval_lives_ok 'proto foo {1; }; sub foo {1; }; sub foo($x) {1; };',
             'multiple declarations need multi or proto';

# vim: ft=perl6
Something went wrong with that request. Please try again.