Skip to content
Browse files

make a range with Real min coerce the max to to Real too

  • Loading branch information...
1 parent ad3a7b6 commit cc19e25e2ed5cf9119b88736707267b50ba6a576 @moritz moritz committed
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/core/Range.pm
View
6 src/core/Range.pm
@@ -8,6 +8,12 @@ class Range is Iterable does Positional {
multi method new($min, $max, :$excludes_min, :$excludes_max) {
nqp::create(self).BUILD($min, $max, $excludes_min, $excludes_max)
}
+ multi method new(Real $min, $max, :$excludes_min, :$excludes_max) {
+ nqp::create(self).BUILD($min, $max.Real, $excludes_min, $excludes_max)
+ }
+ multi method new(Real $min, Whatever $max, :$excludes_min, :$excludes_max) {
+ nqp::create(self).BUILD($min, $Inf, $excludes_min, $excludes_max)
+ }
multi method new($min, Whatever $max, :$excludes_min, :$excludes_max) {
nqp::create(self).BUILD($min, $Inf, $excludes_min, $excludes_max)
}

0 comments on commit cc19e25

Please sign in to comment.
Something went wrong with that request. Please try again.