# New Ticket Created by  Samuel Sutch 
# Please include the string:  [perl #118555]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=118555 >


# with Array[Str] ------------------------------
sub foo(Array[Str] :@vars?) {
   say 'vars: ', @vars.perl;
}

foo(); # dies

# RETURNS:
# ====> Nominal type check failed for parameter '@vars'; expected
Positional but got Array instead

# with Str ---------------------------------------
sub foo2(Str :@vars?) {
    say 'vars2: ', @vars.perl;
}

foo2(); # dies

# RETURNS:
# ====> Nominal type check failed for parameter '@vars'; expected
Positional but got Array instead

# without type --------------------------------
sub foo3(:@vars?) {
    say 'vars3: ', @vars.perl;
}

foo3(); # works

# RETURNS:
# ====> 'vars3: ', Array.new()

Example 1 and 2 should operate the same as 3.
# with Array[Str] ------------------------------
sub foo(Array[Str] :@vars?) {
   say 'vars: ', @vars.perl;
}

foo(); # dies

# RETURNS:
# ====> Nominal type check failed for parameter '@vars'; expected Positional but got Array instead

# with Str ---------------------------------------
sub foo2(Str :@vars?) {
    say 'vars2: ', @vars.perl;
}

foo2(); # dies

# RETURNS:
# ====> Nominal type check failed for parameter '@vars'; expected Positional but got Array instead

# without type --------------------------------
sub foo3(:@vars?) {
    say 'vars3: ', @vars.perl;
}

foo3(); # works

# RETURNS:
# ====> 'vars3: ', Array.new()

Example 1 and 2 should operate the same as 3.

Reply via email to