Skip to content

Commit ee6c4a9

Browse files
committed
[Truffle] - String#downcase! raises a RuntimeError when self is frozen
1 parent d996099 commit ee6c4a9

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
fails:String#downcase is locale insensitive (only replaces A-Z)
22
fails:String#downcase taints result when self is tainted
33
fails:String#downcase returns a subclass instance for subclasses
4-
fails:String#downcase! raises a RuntimeError when self is frozen

truffle/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,8 @@ public RubyBasicObject downcase(RubyString string) {
778778

779779
if (newByteList.equal(string.getBytes())) {
780780
return getContext().getCoreLibrary().getNilObject();
781+
} else if (string.isFrozen()) {
782+
throw new RaiseException(getContext().getCoreLibrary().runtimeError("can't modify frozen string", this));
781783
} else {
782784
string.set(newByteList);
783785
return string;

0 commit comments

Comments
 (0)