Skip to content

Commit fef2003

Browse files
committed
Fix convert_to_native guard
1 parent aa0cb13 commit fef2003

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/org/truffleruby/core/rope/TruffleRopesNodes.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,10 @@ protected RubyString flattenRope(Object string,
170170
@CoreMethod(names = "convert_to_native", onSingleton = true, required = 1)
171171
public abstract static class NativeRopeNode extends CoreMethodArrayArgumentsNode {
172172

173-
@Specialization
174-
protected RubyString nativeRope(RubyString string,
175-
@Cached CExtNodes.StringToNativeNode toNativeNode) {
173+
@Specialization(guards = "strings.isRubyString(string)")
174+
protected Object nativeRope(Object string,
175+
@Cached CExtNodes.StringToNativeNode toNativeNode,
176+
@CachedLibrary(limit = "2") RubyStringLibrary strings) {
176177
toNativeNode.executeToNative(string);
177178
return string;
178179
}

0 commit comments

Comments
 (0)