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

can() on an Enum item doesn't work #4335

Closed
p6rt opened this issue Jun 21, 2015 · 5 comments
Closed

can() on an Enum item doesn't work #4335

p6rt opened this issue Jun 21, 2015 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 21, 2015

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

Searchable as RT125445$

@p6rt
Copy link
Author

p6rt commented Jun 21, 2015

From @jonathanstowe

Hi,

  my enum Bar <A B C>; say B.value; say B.can("value");

1
Too many positionals passed; expected 2 arguments but got 3
  in block <unit> at -e​:1

It looks like "can()" is being passed possibly the flattened Enum or something.

@p6rt
Copy link
Author

p6rt commented Jun 21, 2015

From @lizmat

On 21 Jun 2015, at 12​:10, Jonathan Stowe (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Jonathan Stowe
# Please include the string​: [perl #​125445]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=125445 >

Hi,

my enum Bar <A B C>; say B.value; say B.can("value");

1
Too many positionals passed; expected 2 arguments but got 3
in block <unit> at -e​:1

It looks like "can()" is being passed possibly the flattened Enum or something.

This appears to be a codegen issue somehow.

The call to Mu.can is generated with a (superfluous) Perl6​::Metamodel​::EnumHOW object as the first (SELF) argument, rather than B.

Liz

@p6rt
Copy link
Author

p6rt commented Jun 21, 2015

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

@p6rt
Copy link
Author

p6rt commented Jun 23, 2015

From @jnthn

On Sun Jun 21 03​:10​:36 2015, jns+bc@​gellyfish.co.uk wrote​:

Hi,

my enum Bar <A B C>; say B.value; say B.can("value");

1
Too many positionals passed; expected 2 arguments but got 3
in block <unit> at -e​:1

It looks like "can()" is being passed possibly the flattened Enum or
something.

Turns out far more interesting. The EnumHOW meta-object lacked an implementation of can like ClassHOW, and it then ended up calling the inherited NQPMu.can(...), which expects just the one object being a non-meta-method. Fixed in Rakudo, added tests for .can and .^can to S12-enums/thorough.t.

@p6rt
Copy link
Author

p6rt commented Jun 23, 2015

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

@p6rt p6rt closed this as completed Jun 23, 2015
@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