Commit c702a5f1
c702a5f17c44Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · +2 added · ~1 modified
Description
analyze: Symbol#name return type infers as string
:hello.name previously printed a garbage integer — the codegen
arm already routed to sp_sym_to_s, but analyze's `name` arm
didn't claim the result as a string for symbol receivers, so the
call site treated the const-char-pointer return value as int and
printed its address.
Add the sym → string arm to mirror the existing encoding/class arms.
Fixes #967
Co-Authored-By: Claude Opus 4.7 [email protected]
Details
- Commit
- c702a5f17c44
- Parent
- 803214eb41e4
spinel_analyze.rbmodifiedView file
@@ -4016,6 +4016,9 @@
40164016
if recv >= 0 && infer_type(recv) == "class"40174017
return "string"40184018
end4019+
if recv >= 0 && infer_type(recv) == "symbol"4020+
return "string"4021+
end40194022
# Bare `name` inside `def self.X` body. The implicit recv is40204023
# the class. SelfNode there infers as obj_<C>, so this path40214024
# is needed for the bare form and (separately) the explicittest/symbol_name.rbaddedView file
Loading diff…
test/symbol_name.rb.expectedaddedView file
Loading diff…