Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
don't intuit seq succ/pred when endpoint is Code
  • Loading branch information
TimToady committed Apr 8, 2015
1 parent 322d01b commit e81f470
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/operators.pm
Expand Up @@ -139,7 +139,9 @@ sub SEQUENCE($left, Mu $right, :$exclude_end) {
if nqp::istype($a,Stringy) && nqp::istype($endpoint,Stringy) && $a.codes == 1 && $endpoint.codes == 1 {
$code = $infinite ?? { $^x.ord.succ.chr } !! unisuccpred($a.ord cmp $endpoint.ord);
} else {
$code = $infinite ?? { $^x.succ } !! succpred($a cmp $endpoint);
$code = $infinite || nqp::istype($endpoint,Code)
?? { $^x.succ }
!! succpred($a cmp $endpoint);
}
}
else {
Expand Down Expand Up @@ -175,7 +177,7 @@ sub SEQUENCE($left, Mu $right, :$exclude_end) {
}
}
elsif $tail.elems == 1 {
$code = ($a cmp $endpoint > 0 && !nqp::istype($endpoint,Code))
$code = (!nqp::istype($endpoint,Code) && $a cmp $endpoint > 0 )
?? { $^x.pred }
!! { $^x.succ }
}
Expand Down

0 comments on commit e81f470

Please sign in to comment.