Skip to content
Browse files

Tweak Range.ACCEPTS

As part of trying to figure out what's going on with R#2676, I found 2 things
askew with Range::ACCEPTS:

- a candidate taking Mu
  This means that any Junction will be handled inside the method, rather than
  outside.  Removed the type, so it now defaults to Any.  Even though this
  should not make a difference for the result of the issue, it did.  Alas,
  still wrong.
- a candidate taking Range without :D
  Since this candidate accesses attributes, it will bomb when given a Range
  type object.  So added a :D
  • Loading branch information...
lizmat committed Feb 7, 2019
1 parent df96fa0 commit 46409c070ec49e0ac15e48613215bcdb258783d0
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/Range.pm6
@@ -377,7 +377,7 @@ my class Range is Cool does Iterable does Positional {
!! self.list.Str

multi method ACCEPTS(Range:D: Mu \topic) {
multi method ACCEPTS(Range:D: \topic) {
(topic cmp $!min) > -(!$!excludes-min)
and (topic cmp $!max) < +(!$!excludes-max)
@@ -390,7 +390,7 @@ my class Range is Cool does Iterable does Positional {
multi method ACCEPTS(Range:D: Complex:D \got) {
nqp::istype(($_ := got.Real), Failure) ?? False !! nextwith $_
multi method ACCEPTS(Range:D: Range \topic) {
multi method ACCEPTS(Range:D: Range:D \topic) {
nqp::istype($!min, Numeric)
?? # RHS is a numeric range, use numeric comparators
try {

0 comments on commit 46409c0

Please sign in to comment.
You can’t perform that action at this time.