# New Ticket Created by Faye
# Please include the string: [perl #128726]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=128726 >
$ perl6 -e 'role A[::T = Numeric] { method B() { my T $a; say $a.WHAT } };
A.new.B'
(Numeric)
$ perl6 -e 'role A[::T = Numeric] { method B() { my T @a; say @a.WHAT } };
A.new.B'
Method 'instantiate_generic' not found for invocant of class 'Array[T]'
in method B at -e line 1
in block <unit> at -e line 1
$ perl6 -e 'role A[::T = Numeric] { method B() { my T %a; say %a.WHAT } };
A.new.B'
Method 'instantiate_generic' not found for invocant of class 'Hash[T]'
in method B at -e line 1
in block <unit> at -e line 1
The variable declarations here show a problem in likely the MOP. You can see
this problem in a different light beyond type constraining variables:
$ perl6 -e 'role A[::T = Numeric] { method B() { say T; say Array[T]; say
Hash[T]; } }; A.new.B'
(Numeric)
(Array[T])
(Hash[T])
Namely, the fact that the parameter to arrays and hashes doesn't get "resolved"
like it does as a scalar.