Commit 289ce84b
289ce84baf6fMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 3 files · +1 added · ~2 modified
Description
Return a real array from Module/Class#instance_methods(false)
M.instance_methods(false) const-folded to a sym-array boxed as an opaque
SP_BUILTIN_SYM_ARRAY object. p inspected it fine, but chained operations
saw the box as an empty array: M.instance_methods(false).map(&:to_s).sort
returned [] (and the class form failed to compile).
Build a real sp_PolyArray of boxed symbols and box it as a poly array, so the value matches its declared TY_POLY_ARRAY type and the generic poly-array path (map / sort / include? / length / class) iterates it. Also adds SP_BUILTIN_POLY_ARRAY to sp_poly_class_name's Array case so a boxed poly array reports its class as Array (previously empty -- a latent gap this surfaced).
Fixes #1401 Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]
Details
- Commit
- 289ce84baf6f
- Parent
- b4f21c798b7f
lib/sp_runtime.hmodifiedView file
switch (v.cls_id) { case SP_BUILTIN_INT_ARRAY: case SP_BUILTIN_FLT_ARRAY: case SP_BUILTIN_STR_ARRAY: case SP_BUILTIN_SYM_ARRAY: case SP_BUILTIN_PTR_ARRAY: return SPL("Array"); case SP_BUILTIN_PTR_ARRAY: case SP_BUILTIN_POLY_ARRAY: return SPL("Array"); case SP_BUILTIN_RANGE: return SPL("Range"); case SP_BUILTIN_TIME: return SPL("Time"); case SP_BUILTIN_EXCEPTION: return sp_exc_class_name((volatile struct sp_Exception_s *)v.v.p);src/codegen_call.cmodifiedView file
Loading diff…
test/instance_methods_false_chain.rbaddedView file
Loading diff…