summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorShugo Maeda <shugo@ruby-lang.org>2023-01-19 17:13:07 +0900
committerShugo Maeda <shugo@ruby-lang.org>2023-01-19 17:13:07 +0900
commitf7b72462aa27716370c6bea1f2c240983aca9a55 (patch)
treeb438a7eeb06a0bd884b654d069c3a11bc9de282b /string.c
parent4b42392f8ef66890359f128f0c934601c55a014f (diff)
downloadruby-f7b72462aa27716370c6bea1f2c240983aca9a55.tar.gz
String#bytesplice should return self
In Feature #19314, we concluded that the return value of String#bytesplice should be changed from the source string to the receiver, because the source string is useless and confusing when extra arguments are added. This change should be included in Ruby 3.2.1.
Diffstat (limited to 'string.c')
-rw-r--r--string.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/string.c b/string.c
index de96796269..af5721ecc5 100644
--- a/string.c
+++ b/string.c
@@ -6268,7 +6268,7 @@ rb_str_byteslice(int argc, VALUE *argv, VALUE str)
* bytesplice(index, length, str) -> string
* bytesplice(range, str) -> string
*
- * Replaces some or all of the content of +self+ with +str+, and returns +str+.
+ * Replaces some or all of the content of +self+ with +str+, and returns +self+.
* The portion of the string affected is determined using
* the same criteria as String#byteslice, except that +length+ cannot be omitted.
* If the replacement string is not the same length as the text it is replacing,
@@ -6330,7 +6330,7 @@ rb_str_bytesplice(int argc, VALUE *argv, VALUE str)
cr = ENC_CODERANGE_AND(ENC_CODERANGE(str), ENC_CODERANGE(val));
if (cr != ENC_CODERANGE_BROKEN)
ENC_CODERANGE_SET(str, cr);
- return val;
+ return str;
}
/*