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


As can be seen from the eval below, I specified Int:U as return value of a sub, 
but the error message still calls it just "Int", resulting in a confusing error.

<ZoffixW> m: sub foo returns Int:U { 42 }; foo;
<camelia> rakudo-moar 600eb5: OUTPUT«Type check failed for return value; 
expected Int but got 42␤  in sub foo at /tmp/eErpXMejSF line 1␤  in block 
<unit> at /tmp/eErpXMejSF line 1␤␤»

It's even more confusing with a :D smiley:

<ZoffixW> m: sub foo returns Int:D { my Int $x; $x }; foo;
<camelia> rakudo-moar 600eb5: OUTPUT«Type check failed for return value; 
expected Int but got Int␤  in sub foo at /tmp/fhHB17rE8B line 1␤  in block 
<unit> at /tmp/fhHB17rE8B line 1␤␤»



The error message should include the smiley on the type, as it does for 
variables:

<ZoffixW> m: my Int:U $x = 42;
<camelia> rakudo-moar 600eb5: OUTPUT«Type check failed in assignment to $x; 
expected Int:U but got Int (42)␤  in block <unit> at /tmp/D3t9RObZ2u line 1␤␤»

Reply via email to