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

Misleading error message when trying to augment enums in Rakudo #2766

Closed
p6rt opened this issue May 15, 2012 · 4 comments
Closed

Misleading error message when trying to augment enums in Rakudo #2766

p6rt opened this issue May 15, 2012 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented May 15, 2012

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

Searchable as RT112956$

@p6rt
Copy link
Author

p6rt commented May 15, 2012

From @masak

<masak> r​: use MONKEY_TYPING; enum Weekday <Mon Tue Wed Thu Fri Sat
Sun>; augment class Weekday { multi method succ($ where Sun​:) { Mon }
}; say "alive"
<p6eval> rakudo f69e58​: OUTPUT«===SORRY!===␤Cannot auto-generate a
proto method in the setting␤»
<masak> why am I getting this error message?
<jnthn> masak​: Because it failed to detect the meta-object mismatch at
the point you started augmenting.
<jnthn> masak​: And then EnumHOW ain't set up to support multi-methods
being added.
<masak> where does the setting enter into the picture?
<jnthn> masak​: The code path that issues that is the one that you hit
if you don't explicitly write a proto when declaring a multi in the
setting.
<masak> so it tries to figure out what went wrong, and arrives at a
common cause which isn't applicable in this case?
<jnthn> Right.
* masak submits LTA rakudobug
<jnthn> Well, what's really LTA is it let you get that far.
<masak> aye.
<jnthn> Which I do want to fix. So yes, please file.

@p6rt
Copy link
Author

p6rt commented Mar 8, 2013

From @jnthn

On Tue May 15 14​:23​:56 2012, masak wrote​:

<masak> r​: use MONKEY_TYPING; enum Weekday <Mon Tue Wed Thu Fri Sat
Sun>; augment class Weekday { multi method succ($ where Sun​:) { Mon }
}; say "alive"
<p6eval> rakudo f69e58​: OUTPUT«===SORRY!===␤Cannot auto-generate a
proto method in the setting␤»
<masak> why am I getting this error message?
<jnthn> masak​: Because it failed to detect the meta-object mismatch at
the point you started augmenting.
<jnthn> masak​: And then EnumHOW ain't set up to support multi-methods
being added.
<masak> where does the setting enter into the picture?
<jnthn> masak​: The code path that issues that is the one that you hit
if you don't explicitly write a proto when declaring a multi in the
setting.
<masak> so it tries to figure out what went wrong, and arrives at a
common cause which isn't applicable in this case?
<jnthn> Right.
* masak submits LTA rakudobug
<jnthn> Well, what's really LTA is it let you get that far.
<masak> aye.
<jnthn> Which I do want to fix. So yes, please file.

Now gives a much gooder error​:

use MONKEY_TYPING; enum Weekday <Mon Tue Wed Thu Fri Sat Sun>; augment
class Weekday { multi method succ($ where Sun​:) { Mon } }; say "alive"
===SORRY!===
Cannot augment Weekday because it is closed
at <unknown file>​:1
------> Thu Fri Sat Sun>; augment class Weekday <HERE>{ multi method
succ($ where Sun​:) { Mon

I added a test that it threw the correct typed exception, so resolving.

/jnthn

@p6rt
Copy link
Author

p6rt commented Mar 8, 2013

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

@p6rt
Copy link
Author

p6rt commented Mar 8, 2013

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

@p6rt p6rt closed this as completed Mar 8, 2013
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant