Skip to content

Commit

Permalink
Make (foo .. foo).reverse correctly
Browse files Browse the repository at this point in the history
Fixes R#3597
  • Loading branch information
lizmat committed Apr 5, 2020
1 parent 3983b4f commit c588323
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core.c/Range.pm6
Expand Up @@ -291,6 +291,13 @@ my class Range is Cool does Iterable does Positional {
Rakudo::Iterator.Empty
}

# endpoints are same
elsif $!min === $!max {
$!excludes-min || $!excludes-max
?? Rakudo::Iterator.Empty
!! Rakudo::Iterator.OneValue($!min)
}

# Also something quick and easy for -Inf..42 style things
elsif nqp::istype($!min, Numeric) && $!min === -Inf {
NumReverse.new($!max - $!excludes-max)
Expand Down

0 comments on commit c588323

Please sign in to comment.