Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

exhaustive capture too greedy (Or bogus test?) #4227

Open p6rt opened 9 years ago

p6rt commented 9 years ago

Migrated from rt.perl.org#125133 (status was 'open')

Searchable as RT125133$

p6rt commented 9 years ago

From @FROGGS

See​: https://github.com/perl6/roast/blob/master/S05-modifier/repetition-exhaustive.t

p6rt commented 8 years ago

From @smls

I think this may be a dubious test rather than a Rakudo bug.

For reference, the code tested by the fudged test in question boils down to this​:

  ➜ say "abbb" ~~ m​:ex/"a" b+/;   (「abbb」 「abb」 「ab」)

The test then checks if the first element of the result is "ab", and the second is "abb" - which is not the case because they are returned in the opposite order.

Why is the test assuming that the results with the same starting position have to be returned in a specific order? S05 specifically states that the order is not defined in such a case​:

  The matches are guaranteed to be returned in left-to-right order with respect   to the starting positions. The order within each starting position is not   guaranteed and may depend on the nature of both the pattern and the matching   engine. (Conjecture​: or we could enforce backtracking engine semantics. Or we   could guarantee no order at all unless the pattern starts with "​::" or some   such to suppress DFAish solutions.)

(FYI​: Rakudo's current behavior seems to implement the "enforce backtracking engine semantics" conjecture.)

It looks to me like the test should sort the results, before checking that the first two are "ab" and "abb".

p6rt commented 8 years ago

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