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


If a defined value is used as a type constraint, the values that the
constraint will accept are inconsistent between using the type constraint
on a variable and using it on a sub parameter:

> constant T = 3
3
> 3.^isa(T)
0
> (sub (T $a) { 1 })(3)
1
> my T $a = 3
Type check failed in assignment to $a; expected 3 but got 3
  in block <unit> at <unknown file>:1

The two type constraint situations are consistent in disallowing other
values such as 2, "foo", and Int.  It probably should not be permitted
at all to use anything other than a type object as a type constraint.
See also [perl #126117].

-zefram

Reply via email to