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 end
4019+ if recv >= 0 && infer_type(recv) == "symbol"
4020+ return "string"
4021+ end
40194022 # Bare `name` inside `def self.X` body. The implicit recv is
40204023 # the class. SelfNode there infers as obj_<C>, so this path
40214024 # is needed for the bare form and (separately) the explicit