Commit 0b41b359
0b41b35951a2Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 5 files · ~5 modified
Description
Type instance &block params from the block's call-site args
infer_proc_blk_param_types projected block-param types from blk.call
arguments for top-level (@meth_) and singleton (@cls_cmeth_) methods,
but not instance methods. So an instance def run(&blk); blk.call(x) end left its block params at the int default, and run { |x| x.upcase } could not resolve string methods on the param (emitted 0 / blank).
Add the parallel instance-method projection (@cls_meth_blk_param_types) and consume it: blk_param_types_for_body resolves instance method body ids, and the instance &block-forward call site sources the proc literal's param types from it.
Refs #1362
Co-Authored-By: Claude Opus 4.8 [email protected]
Details
- Commit
- 0b41b35951a2
- Parent
- 033037f844a0
compiler_helpers.rbmodifiedView file
compiler_state_sa :lambda_var_ret_names, :lambda_var_ret_types, :multi_const_inits, :meth_blk_param_types, :cls_cmeth_blk_param_types compiler_state_sa :iexec_block_pnames, :iexec_block_ptypes compiler_state_sa :attr_alias_keys, :attr_alias_ivars compiler_state_sa :cls_meth_blk_param_types compiler_state_ia :meth_body_ids, :meth_rest_index, :meth_kwrest_index, :meth_has_yield, :cls_rest_idxs, :cls_is_value_type compiler_state_ia :cls_is_sra, :const_expr_ids, :const_mutated, :gvar_written, :module_body_ids, :ffi_buf_sizes, :ffi_reader_offsetsspinel_analyze.rbmodifiedView file
Loading diff…
spinel_codegen.rbmodifiedView file
Loading diff…
test/block_param_call_value_return.rbmodifiedView file
Loading diff…
test/block_param_call_value_return.rb.expectedmodifiedView file
Loading diff…