Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More idiomatic solution to RT #125402, jnthn++
  • Loading branch information
lizmat committed Jun 23, 2015
1 parent c81fdcb commit 379ece6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/Str.pm
Expand Up @@ -1808,13 +1808,13 @@ sub substr-rw(\what, \start, $want?) is rw {
nqp::unbox_s($Str), nqp::unbox_i($from), nqp::unbox_i($chars)
));
},
STORE => sub ($, $new) {
STORE => sub ($, Str() $new) {
my $str = nqp::unbox_s($Str);
what = nqp::p6box_s(
nqp::concat(
nqp::substr($str,0,nqp::unbox_i($from)),
nqp::concat(
nqp::unbox_s(nqp::istype($new, Str) ?? $new !! $new.Str),
nqp::unbox_s($new),
nqp::substr($str,nqp::unbox_i($from + $chars))
)
)
Expand Down

0 comments on commit 379ece6

Please sign in to comment.