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

Error when role stubbed as class #5754

Closed
p6rt opened this issue Oct 17, 2016 · 6 comments
Closed

Error when role stubbed as class #5754

p6rt opened this issue Oct 17, 2016 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Oct 17, 2016

Migrated from rt.perl.org#129906 (status was 'resolved')

Searchable as RT129906$

@p6rt
Copy link
Author

p6rt commented Oct 17, 2016

From @zostay

One line example of the problem​:

% perl6 -e 'class A { ... }; class B does A { }; role A { }'
Unhandled exception​: No such method 'item' for invocant of type 'A'
  at <unknown>​:1
(/Users/sterling/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm​:print_exception)
from gen/moar/m-CORE.setting​:24949
(/Users/sterling/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm​:<anon>)
from gen/moar/stage2/NQPHLL.nqp​:1559
(/Users/sterling/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm​:command_eval)
from src/Perl6/Compiler.nqp​:27
(/Users/sterling/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Compiler.moarvm​:command_eval)
from gen/moar/stage2/NQPHLL.nqp​:1499
(/Users/sterling/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm​:command_line)
from gen/moar/m-main.nqp​:47
(/Users/sterling/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm​:MAIN)
from gen/moar/m-main.nqp​:38
(/Users/sterling/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm​:<mainline>)
from <unknown>​:1
(/Users/sterling/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm​:<main>)
from <unknown>​:1
(/Users/sterling/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm​:<entry>)

Clearly, it would be better for there to be a nice error like "type A
stubbed as class on line X but implemented as role on line Y".
--
Sterling Hanenkamp
http://sterling.hanenkamp.com/stfl/
785-370-4454

@p6rt
Copy link
Author

p6rt commented Nov 8, 2016

From @zoffixznet

There's another couple of LTA errors for this, such us when a stubbed class is attempted to be `does` with or when a stubbed role is `does` with before it's defined​:

<ZoffixW> m​: class A { ... }; class B does A { }; class A { }
<camelia> rakudo-moar a581bf​: OUTPUT«Unhandled exception​: No such method 'item' for invocant of type 'A'␤ at <unknown>​:1 (/home/camelia/rakudo-m-inst-1/share/perl6/runtime/CORE.setting.moarvm​:print_exception)␤ from gen/moar/m-CORE.setting​:26858 (/home/camelia/rakudo-m-inst-1/share/per…»
<ZoffixW> m​: role A { ... }; class B does A { }; role A { }
<camelia> rakudo-moar a581bf​: OUTPUT«Use of uninitialized value of type Any in string context.␤Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.␤ in any try_select at gen/moar/m-Metamodel.nqp line 2647␤===SORRY!=== Error while compiling <t…»

On Mon, 17 Oct 2016 16​:08​:31 -0700, hanenkamp wrote​:

One line example of the problem​:

% perl6 -e 'class A { ... }; class B does A { }; role A { }'
Unhandled exception​: No such method 'item' for invocant of type 'A'
at <unknown>​:1
(/Users/sterling/.rakudobrew/moar-
nom/install/share/perl6/runtime/CORE.setting.moarvm​:print_exception)
from gen/moar/m-CORE.setting​:24949
(/Users/sterling/.rakudobrew/moar-
nom/install/share/perl6/runtime/CORE.setting.moarvm​:<anon>)
from gen/moar/stage2/NQPHLL.nqp​:1559
(/Users/sterling/.rakudobrew/moar-
nom/install/share/nqp/lib/NQPHLL.moarvm​:command_eval)
from src/Perl6/Compiler.nqp​:27
(/Users/sterling/.rakudobrew/moar-
nom/install/share/nqp/lib/Perl6/Compiler.moarvm​:command_eval)
from gen/moar/stage2/NQPHLL.nqp​:1499
(/Users/sterling/.rakudobrew/moar-
nom/install/share/nqp/lib/NQPHLL.moarvm​:command_line)
from gen/moar/m-main.nqp​:47
(/Users/sterling/.rakudobrew/moar-
nom/install/share/perl6/runtime/perl6.moarvm​:MAIN)
from gen/moar/m-main.nqp​:38
(/Users/sterling/.rakudobrew/moar-
nom/install/share/perl6/runtime/perl6.moarvm​:<mainline>)
from <unknown>​:1
(/Users/sterling/.rakudobrew/moar-
nom/install/share/perl6/runtime/perl6.moarvm​:<main>)
from <unknown>​:1
(/Users/sterling/.rakudobrew/moar-
nom/install/share/perl6/runtime/perl6.moarvm​:<entry>)

Clearly, it would be better for there to be a nice error like "type A
stubbed as class on line X but implemented as role on line Y".

@p6rt
Copy link
Author

p6rt commented Nov 8, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Nov 9, 2016

From @zoffixznet

More comments and other error triggers​: https://irclog.perlgeek.de/perl6/2016-11-09#i_13540625

@p6rt
Copy link
Author

p6rt commented Nov 9, 2016

From @zoffixznet

Thanks for the report.

Fixed in rakudo/rakudo@a822bcf9cf
Tests added in Raku/roast@1e5a081bed

@p6rt
Copy link
Author

p6rt commented Nov 9, 2016

@zoffixznet - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Nov 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant