You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ 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.
Migrated from rt.perl.org#128726 (status was 'new')
Searchable as RT128726$
The text was updated successfully, but these errors were encountered: