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

No space between a class trait and { #5041

Open
p6rt opened this issue Jan 11, 2016 · 2 comments
Open

No space between a class trait and { #5041

p6rt opened this issue Jan 11, 2016 · 2 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

Comments

@p6rt
Copy link

p6rt commented Jan 11, 2016

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

Searchable as RT127242$

@p6rt
Copy link
Author

p6rt commented Jan 11, 2016

From @zoffixznet

This produces a confusing error​:

<ZoffixW> m​: class Foo is Int{}
<camelia> rakudo-moar 42a583​: OUTPUT«===SORRY!=== Error while compiling /tmp/poMXu0zSBD␤Cannot call trait_mod​:<is>(Foo, Int, Hash); none of these signatures match​:␤ (Mu​:U $child, Mu​:U $parent)␤ (Mu​:U $child, :$DEPRECATED!)␤ (Mu​:U $type, :$rw!)␤ (Mu​:U $type, :$nativ…»

Perhaps, the same thing that's done for subs can be extended for classes too​:
<ZoffixW> m​: sub foo is export{}
<camelia> rakudo-moar 42a583​: OUTPUT«===SORRY!===␤Trait 'is export' needs whitespace before block␤at /tmp/5tO_UVrVAD​:1␤------> sub foo is export{}⏏<EOL>␤Missing block (apparently claimed by 'is export')␤at /tmp/5tO_UVrVAD​:1␤------> sub foo is export{}⏏<EOL>…»
<TimToady> maybe that's what we're thinking of

Relevant IRC conversation​: http://irclog.perlgeek.de/perl6/2016-01-11#i_11869850

@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 14, 2023

The error message looks awesome now:

$ ./rakudo-m -e 'class Foo is Int{}'
===SORRY!=== Error while compiling -e
Parent class specification is probably missing some whitespace.  Found
'Foo is Int{ ...', which tries to specify a parent with a 'Hash'.  You
probably meant 'Foo is Int { ...'.
at -e:1

The problem was also mentioned in rakudo/rakudo#2052 and was fixed/improved with rakudo/rakudo@21eb168ca4, rakudo/rakudo@1956df255207 and later on rakudo/rakudo@98c7e512a6.

IMHO it would be nice to have a test for Rakudo, so I'm leaving this issue open for now.

@usev6 usev6 added the rakudo tests The tests for this issue should be placed into Rakudo's own test suite, instead of roast label Oct 14, 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
Projects
None yet
Development

No branches or pull requests

2 participants