# New Ticket Created by Elizabeth Mattijsen # Please include the string: [perl #128964] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=128964 >
<lizmat> m: sub a( --> Str() ) { 42 }; dd a # should this work ? <camelia> rakudo-moar 6cd6ef: OUTPUT«Type check failed for return value; expected Str(Any) but got Int (42) in block <unit> at <tmp> line 1» <gfldex> lizmat: this should not work <gfldex> m: sub a( --> Str(Int) ) { 42 }; dd a <camelia> rakudo-moar 6cd6ef: OUTPUT«Type check failed for return value; expected Str(Int) but got Int (42) in block <unit> at <tmp> line 1» <gfldex> but this should (and do the right thing) <gfldex> m: sub a( --> Str(Int) ) { 42.Str }; dd a <camelia> rakudo-moar 6cd6ef: OUTPUT«Type check failed for return value; expected Str(Int) but got Str ("42") in block <unit> at <tmp> line 1» <lizmat> gfldex: but Str() is just short for Str(Any), so why shouldn't Str() work? <gfldex> oh yes, it should work but doesn't yet. There may be a RT already. <gfldex> lizmat: i just checked RT for "return" and could not find a matching RT for this <lizmat> gfldex: ok, shall I RT it or will you ? <gfldex> please RT