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

Something funny with modifying a subset where part of the check is calling a method on the item #5092

Closed
p6rt opened this issue Jan 27, 2016 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jan 27, 2016

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

Searchable as RT127394$

@p6rt
Copy link
Author

p6rt commented Jan 27, 2016

From @jonathanstowe

  perl6 -e 'subset JJ where *.can("foo"); -> JJ​:D $a { } '
  ===SORRY!===
  Method 'iterator' must be implemented by Iterable because it is required by a role

This does not happen without the Type modifier in the signature, i.e.

  subset JJ where *.can("foo"); -> JJ $a { }

But a modified subset that does not call a method is fine​:

  subset JJ where { True }; -> JJ​:D $a { }

But it appears that in fact that it isn't 'can' that is the culprit but using *any* method on the item​:

  perl6 -e 'subset JJ where *.foo; -> JJ​:D $a { } '
  ===SORRY!===
  Method 'iterator' must be implemented by Iterable because it is required by a role

@p6rt
Copy link
Author

p6rt commented Jan 27, 2016

From @jonathanstowe

Method 'iterator' must be implemented by Iterable because it is required by a role
  at gen/moar/m-Metamodel.nqp​:2801 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Metamodel.moarvm​:compose_method_table​:84)
from gen/moar/m-Metamodel.nqp​:2811 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Metamodel.moarvm​:apply​:346)
from gen/moar/m-Metamodel.nqp​:2984 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Metamodel.moarvm​:compose​:94)
from gen/moar/m-Metamodel.nqp​:1683 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Metamodel.moarvm​:make_pun​:66)
from gen/moar/m-Metamodel.nqp​:1711 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Metamodel.moarvm​:find_method​:57)
from -e​:1 (<ephemeral file>​::9)
from src/Perl6/World.nqp​:2004 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/World.moarvm​::17)
from gen/moar/m-CORE.setting​:6420 (/home/jonathan/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm​:ACCEPTS​:43)
from gen/moar/m-CORE.setting​:869 (/home/jonathan/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm​:ACCEPTS​:39)
from gen/moar/m-Metamodel.nqp​:3417 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Metamodel.moarvm​:accepts_type​:22)
from gen/moar/m-Perl6-Actions.nqp​:8215 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Actions.moarvm​:lower_signature​:2843)
from gen/moar/m-Perl6-Actions.nqp​:7799 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Actions.moarvm​:add_signature_binding_code​:208)
from gen/moar/m-Perl6-Actions.nqp​:1390 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Actions.moarvm​:pblock​:794)
from gen/moar/stage2/QRegex.nqp​:1342 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/QRegex.moarvm​:!reduce​:29)
from gen/moar/stage2/QRegex.nqp​:1303 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/QRegex.moarvm​:!cursor_pass​:47)
from src/Perl6/Grammar.nqp​:1287 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Grammar.moarvm​:pblock​:717)
from src/Perl6/Grammar.nqp​:1672 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Grammar.moarvm​:term​:sym<lambda>​:66)
from gen/moar/stage2/QRegex.nqp​:1379 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/QRegex.moarvm​:!protoregex​:109)
from <unknown>​:1 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Grammar.moarvm​:term​:10)
from src/Perl6/Grammar.nqp​:3733 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Grammar.moarvm​:termish​:410)
from gen/moar/stage2/NQPHLL.nqp​:683 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm​:EXPR​:74)
from src/Perl6/Grammar.nqp​:3768 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Grammar.moarvm​:EXPR​:28)
from src/Perl6/Grammar.nqp​:1225 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Grammar.moarvm​:statement​:401)
from src/Perl6/Grammar.nqp​:1154 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Grammar.moarvm​:statementlist​:241)
from gen/moar/stage2/NQPHLL.nqp​:907 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm​:LANG​:146)
from src/Perl6/Grammar.nqp​:1544 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Grammar.moarvm​:FOREIGN_LANG​:67)
from src/Perl6/Grammar.nqp​:1138 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Grammar.moarvm​:comp_unit​:1029)
from src/Perl6/Grammar.nqp​:441 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Grammar.moarvm​:TOP​:524)
from gen/moar/stage2/QRegex.nqp​:2093 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/QRegex.moarvm​:parse​:44)
from gen/moar/stage2/NQPHLL.nqp​:1594 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm​:parse​:80)
from gen/moar/stage2/NQPHLL.nqp​:1550 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm​:compile​:200)
from gen/moar/stage2/NQPHLL.nqp​:1287 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm​:eval​:62)
from gen/moar/stage2/NQPHLL.nqp​:1394 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm​::35)
from gen/moar/stage2/NQPHLL.nqp​:1391 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm​:command_eval​:155)
from src/Perl6/Compiler.nqp​:69 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Compiler.moarvm​:command_eval​:93)
from gen/moar/stage2/NQPHLL.nqp​:1375 (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm​:command_line​:114)
from gen/moar/m-main.nqp​:37 (/home/jonathan/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm​:MAIN​:18)
from gen/moar/m-main.nqp​:33 (/home/jonathan/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm​:<mainline>​:189)
from <unknown>​:1 (/home/jonathan/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm​:<main>​:8)
from <unknown>​:1 (/home/jonathan/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6.moarvm​:<entry>​:9)

@p6rt
Copy link
Author

p6rt commented Jul 21, 2016

From @jnthn

On Wed Jan 27 12​:12​:17 2016, jns+bc@​gellyfish.co.uk wrote​:

perl6 -e 'subset JJ where *.can("foo"); -> JJ​:D $a { } '
===SORRY!===
Method 'iterator' must be implemented by Iterable because it is
required by a role

This does not happen without the Type modifier in the signature, i.e.

subset JJ where *.can("foo"); -> JJ $a { }

But a modified subset that does not call a method is fine​:

subset JJ where { True }; -> JJ​:D $a { }

But it appears that in fact that it isn't 'can' that is the culprit
but using *any* method on the item​:

perl6 -e 'subset JJ where *.foo; -> JJ​:D $a { } '
===SORRY!===
Method 'iterator' must be implemented by Iterable because it is
required by a role

We were mishandling the Subtype​:D case in general, and sometimes it just didn't go quite so badly as other times. I've hopefully fixed that now, and added some tests in S12-subset/subtypes.t.

@p6rt
Copy link
Author

p6rt commented Jul 21, 2016

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

@p6rt
Copy link
Author

p6rt commented Jul 21, 2016

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

@p6rt p6rt closed this as completed Jul 21, 2016
@p6rt
Copy link
Author

p6rt commented Jul 28, 2016

From 1parrota@gmail.com

jnthn's been working really hard.
My thumb's tired just from paging through all these ticket closings. :-)*
Great work, sir!

On 7/21/16, jnthn@​jnthn.net via RT <perl6-bugs-followup@​perl.org> wrote​:

On Wed Jan 27 12​:12​:17 2016, jns+bc@​gellyfish.co.uk wrote​:

perl6 -e 'subset JJ where *.can("foo"); -> JJ​:D $a { } '
===SORRY!===
Method 'iterator' must be implemented by Iterable because it is
required by a role

This does not happen without the Type modifier in the signature, i.e.

subset JJ where *.can("foo"); -> JJ $a { }

But a modified subset that does not call a method is fine​:

subset JJ where { True }; -> JJ​:D $a { }

But it appears that in fact that it isn't 'can' that is the culprit
but using *any* method on the item​:

perl6 -e 'subset JJ where *.foo; -> JJ​:D $a { } '
===SORRY!===
Method 'iterator' must be implemented by Iterable because it is
required by a role

We were mishandling the Subtype​:D case in general, and sometimes it just
didn't go quite so badly as other times. I've hopefully fixed that now, and
added some tests in S12-subset/subtypes.t.

@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