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


This works:

‎‎    ➜  role R [::T] { has T $.a = T };  say R[Int].new.a;
‎‎    (Int)

But remove the explicit initializer `= T` (which should be redundant, 
right?), and it blows up:

‎‎    ➜  role R [::T] { has T $.a };  say R[Int].new.a;
‎‎    No such method 'gist' for invocant of type 'T'
‎‎      in block <unit> at <unknown file> line 1

Looks like the automatic initializer for `$.a` leaves the type object of 
the generic type T in the attribute, instead of letting it become the 
concrete type Int.
Some introspection:

     say R[Int].new.a.^name;  # T
     say R[Int].new.a.HOW;    # Perl6::Metamodel::GenericHOW.new

Reply via email to