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


The coercion works fine here:

17:03   Zoffix  m: class B {…}; class A { method B { B.new }}; class B {}; sub 
foo(B() $b) { say "hi" }; foo(A.new)
17:03   camelia         rakudo-moar 2fb8c7: OUTPUT: «hi?»

But if I add `:D` smiley, it fails:

17:03   Zoffix  m: class B {…}; class A { method B { B.new }}; class B {}; sub 
foo(B:D() $b) { say "hi" }; foo(A.new)
17:03   camelia         rakudo-moar 2fb8c7: OUTPUT: «Type check failed in 
binding to parameter '$b'; expected B but got A (A.new)?  in sub foo at <tmp> 
line 1?  in block <unit> at <tmp> line 1??»

https://irclog.perlgeek.de/perl6/2017-07-24#i_14915397

Reply via email to