# New Ticket Created by Sam S.
# Please include the string: [perl #131948]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=131948 >
➜ sub f (::T --> T) { T.new }
➜ f Int;
Died with X::TypeCheck::Return
in sub f at [...]
The type alias T works just fine in the rest of the subroutine signature
and body; just not inside the return type constraint, and also not in
the return type constraint of any nested subroutine:
➜ sub f (::T) { sub g (--> T) { T.new } }
➜ say f(Int)();
Died with X::TypeCheck::Return
in sub g at [...]
The alternative `returns T` and `of T` syntaxes suffer from the same
problem.