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


# Rakudo version 2017.04.3 built on MoarVM version 2017.04-53-g66c6dda 
implementing Perl 6.c.

# Not constraining to a defined type works:
role R[::T] {
has T $.x = T.new(0);
method new() {return self.bless(:x(42e0));}
};
class C does R[Num] {};
C.new();

# Constraining to a defined type works if the type constraint is not 
parameterized.
role R {
has Num:D $.x = Num.new(0);
method new() {return self.bless(:x(42e0));}
};
class C does R {};
C.new();

# Both parameterizing and constraining to a defined type fails.
role R[::T] {
has T:D $.x = T.new(0);
method new() {return self.bless(:x(42e0));}
};
class C does R[Num] {};
C.new();
# OUTPUT: X::TypeCheck::Assignment exception produced no message

# The failure seems to occur during the bless.

Reply via email to