Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smileys on return still results in non-smiley types in error message #5215

Open
p6rt opened this issue Apr 5, 2016 · 3 comments
Open

Smileys on return still results in non-smiley types in error message #5215

p6rt opened this issue Apr 5, 2016 · 3 comments
Labels
LTA Less Than Awesome; typically an error message that could be better rakudo tests The tests for this issue should be placed into Rakudo's own test suite, instead of roast testneeded

Comments

@p6rt
Copy link

p6rt commented Apr 5, 2016

Migrated from rt.perl.org#127842 (status was 'new')

Searchable as RT127842$

@p6rt
Copy link
Author

p6rt commented Apr 5, 2016

From @zoffixznet

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␤␤»

@p6rt
Copy link
Author

p6rt commented Jul 10, 2016

From @zoffixznet

Still present in Rakudo version 2016.06-154-g55c359e built on MoarVM version 2016.06-9-g8fc21d5

@p6rt p6rt added the LTA Less Than Awesome; typically an error message that could be better label Jan 5, 2020
@usev6
Copy link

usev6 commented Oct 7, 2023

The error message includes the smiley on the type nowadays:

$ ./rakudo-m -e 'sub foo returns Int:U { 42 }; foo'
Type check failed for return value; expected Int:U but got Int (42)
  in sub foo at -e line 1
  in block <unit> at -e line 1

$ ./rakudo-m -e 'sub foo returns Int:D { my Int $x; $x }; foo'
Type check failed for return value; expected Int:D but got Int (Int)
  in sub foo at -e line 1
  in block <unit> at -e line 1

Tagging "testneeded". (But IMHO the tests should be added to Rakudo's tests, not to Roast.)

@usev6 usev6 added rakudo tests The tests for this issue should be placed into Rakudo's own test suite, instead of roast testneeded labels Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTA Less Than Awesome; typically an error message that could be better rakudo tests The tests for this issue should be placed into Rakudo's own test suite, instead of roast testneeded
Projects
None yet
Development

No branches or pull requests

2 participants