Commit fce6225a
fce6225a1cf0Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 4 files · +2 added · ~2 modified
Description
Implement callee, String#clone, NilClass#itself
Three small built-in method gaps from #1222:
- callee resolves like method (the current method name).
- String#clone behaves like dup for the value (scoped to string / mutable_str so it doesn't intercept array/hash clone).
- NilClass#itself returns nil.
Refs #1222
Co-Authored-By: Claude Opus 4.8 [email protected]
Details
- Commit
- fce6225a1cf0
- Parent
- 24654f0664be
spinel_analyze.rbmodifiedView file
@@ -4286,7 +4286,7 @@
42864286
if mname == "itself" || mname == "then" || mname == "yield_self"42874287
return 142884288
end4289-
if mname == "getbyte" || mname == "setbyte" || mname == "__method__" || mname == "__dir__"4289+
if mname == "getbyte" || mname == "setbyte" || mname == "__method__" || mname == "__callee__" || mname == "__dir__"42904290
return 142914291
end42924292
if mname == "slice!" || mname == "intern"@@ -4984,7 +4984,7 @@
49844984
if mname == "setbyte"49854985
return "int"49864986
end4987-
if mname == "__method__"4987+
if mname == "__method__" || mname == "__callee__"49884988
return "string"49894989
end49904990
# Issue #878: Kernel#__dir__ -- compile-time string.@@ -5076,6 +5076,16 @@
50765076
end50775077
return "string"50785078
end5079+
# String#clone behaves like dup for the value (spinel doesn't track5080+
# the frozen-state copy distinction). Scoped to string/mutable_str so5081+
# it doesn't intercept array/hash clone, which have their own paths.5082+
# Issue #1222.5083+
if mname == "clone" && recv >= 05084+
rt_cl = infer_type(recv)5085+
if rt_cl == "string" || rt_cl == "mutable_str"5086+
return rt_cl5087+
end5088+
end50795089
if mname == "ord"50805090
return "int"50815091
endspinel_codegen.rbmodifiedView file
Loading diff…
test/object_method_gaps_callee_clone_itself.rbaddedView file
Loading diff…
test/object_method_gaps_callee_clone_itself.rb.expectedaddedView file
Loading diff…