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

.first($regex) throws error on element that doesn't support method .match #5610

Closed
p6rt opened this issue Aug 22, 2016 · 5 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 22, 2016

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

Searchable as RT129044$

@p6rt
Copy link
Author

p6rt commented Aug 22, 2016

From @smls

These work fine​:

  say /a/.ACCEPTS​: (a=>2); # 「a」
  say (a=>2) ~~ /a/; # 「a」

But this fails​:

  say (a=>2,).first(/a/); # ERROR​: Method 'match' not found for invocant of class 'Pair'

IRC discussion​:

  smls​: ^^ This is a bug, right?
  smls​: Looks like .first might be cutting corners by calling
  $element.match($predicate) instead of $predicate.ACCEPTS($element)
  in case of a regex predicate
  jnthn​: Looks like

@p6rt
Copy link
Author

p6rt commented Aug 23, 2016

From @lizmat

Fixed with 157b46e , tests needed

On 22 Aug 2016, at 12​:05, Sam S. (via RT) <perl6-bugs-followup@​perl.org> wrote​:

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

These work fine​:

say /a/.ACCEPTS​: (a=>2); # 「a」
say (a=>2) ~~ /a/; # 「a」

But this fails​:

say (a=>2,).first(/a/); # ERROR​: Method 'match' not found for invocant of class 'Pair'

IRC discussion​:

smls​: ^^ This is a bug, right?
smls​: Looks like .first might be cutting corners by calling
$element.match($predicate) instead of $predicate.ACCEPTS($element)
in case of a regex predicate
jnthn​: Looks like

@p6rt
Copy link
Author

p6rt commented Aug 23, 2016

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

@p6rt
Copy link
Author

p6rt commented Aug 23, 2016

From @AlexDaniel

On 2016-08-23 00​:05​:24, elizabeth wrote​:

Fixed with 157b46e , tests needed

On 22 Aug 2016, at 12​:05, Sam S. (via RT) <perl6-bugs-
followup@​perl.org> wrote​:

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

These work fine​:

say /a/.ACCEPTS​: (a=>2); # 「a」
say (a=>2) ~~ /a/; # 「a」

But this fails​:

say (a=>2,).first(/a/); # ERROR​: Method 'match' not found for
invocant of class 'Pair'

IRC discussion​:

smls​: ^^ This is a bug, right?
smls​: Looks like .first might be cutting corners by calling
$element.match($predicate) instead of
$predicate.ACCEPTS($element)
in case of a regex predicate
jnthn​: Looks like

Tests added in 4317d5826aea42ca22ce6a64691a52313411275d

@p6rt
Copy link
Author

p6rt commented Aug 23, 2016

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

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