[ruby-core:124431] [Ruby Feature#6012] Proc#source_location also return the column
Issue #6012 has been updated by mame (Yusuke Endoh). Note that there is also an idiom like `foo(*obj.source_location)`, not just `source_location.last`. By checking the result of "gem-codesearch", we see not only `@binding.source_location` but also `@proc.source_location`. I am not sure if these are actually affected, though. I guess there are probably other affected code patterns. ``` $ gem-codesearch -f rb "\\(.*\\*.*\\.source_location[^\\[]" 1980-01-02 /srv/gems/alchemy_cms-8.0.2/vendor/bundle/ruby/3.4.0/gems/web-console-4.2.1/lib/web_console/evaluator.rb: "=> #{@binding.eval(input, *@binding.source_location).inspect}\n" 1980-01-02 /srv/gems/alchemy_i18n-5.0.1/vendor/bundle/ruby/4.0.0/gems/alchemy_cms-8.0.2/vendor/bundle/ruby/3.4.0/gems/web-console-4.2.1/lib/web_console/evaluator.rb: "=> #{@binding.eval(input, *@binding.source_location).inspect}\n" 2017-06-09 /srv/gems/aristotle-0.3.0/lib/aristotle/presenter.rb: code = find_code(*proc.source_location) || 'no code found' 2025-12-10 /srv/gems/cucumber-10.2.0/lib/cucumber/glue/hook.rb: @location = Cucumber::Core::Test::Location.from_source_location(*@proc.source_location) 2025-12-10 /srv/gems/cucumber-10.2.0/lib/cucumber/glue/registry_and_more.rb: location = Cucumber::Core::Test::Location.from_source_location(*proc.source_location) 2025-12-10 /srv/gems/cucumber-10.2.0/lib/cucumber/glue/step_definition.rb: @location ||= Cucumber::Core::Test::Location.from_source_location(*@proc.source_location) 2010-04-06 /srv/gems/dde-0.2.11/spec/spec_helper.rb: it description_from(caller[0]), &block # it description_from(*block.source_location), &block 2010-01-16 /srv/gems/git_hub-0.3.0/spec/spec_helper.rb: it description_from(*block.source_location), &block 2017-04-17 /srv/gems/ikra-0.0.2/lib/sourcify/lib/sourcify/method/parser.rb: @source_code = SourceCode.new(*_meth.source_location) 2017-04-17 /srv/gems/ikra-0.0.2/lib/sourcify/lib/sourcify/proc/parser.rb: @arity, @source_code = _proc.arity, SourceCode.new(*_proc.source_location(false)) 1980-01-02 /srv/gems/irb-kit-2.0.0/lib/irb/kit/handlers/method_editor.rb: editor.call(*object.method(name).source_location) 2017-12-11 /srv/gems/lab42_core-0.5.1/lib/lab42/core/kernel.rb: dir = File.expand_path File.join( '..', blk.(), '*.rb'), blk.source_location.first 2011-08-02 /srv/gems/live_ast-1.0.2/lib/live_ast/base.rb: Linker.find_method_ast(obj.owner, obj.name, *obj.source_location) 2011-08-02 /srv/gems/live_ast-1.0.2/lib/live_ast/linker.rb: ast = find_ast(*obj.source_location) or raise ASTNotFoundError 2016-10-31 /srv/gems/mobiusloop-0.1.5/lib/cucumber/filters/prepare_world.rb: empty_hook_location = Cucumber::Core::Ast::Location.from_source_location(*empty_hook.source_location) 2016-10-31 /srv/gems/mobiusloop-0.1.5/lib/cucumber/rb_support/rb_hook.rb: @location = Cucumber::Core::Ast::Location.from_source_location(*@proc.source_location) 2016-10-31 /srv/gems/mobiusloop-0.1.5/lib/cucumber/rb_support/rb_language.rb: location = Cucumber::Core::Ast::Location.from_source_location(*proc.source_location) 2016-10-31 /srv/gems/mobiusloop-0.1.5/lib/cucumber/rb_support/rb_step_definition.rb: @location ||= Cucumber::Core::Ast::Location.from_source_location(*@proc.source_location) 1980-01-02 /srv/gems/mvz-live_ast-2.3.0/lib/live_ast/base.rb: Linker.find_method_ast(obj.owner, obj.name, *obj.source_location) 1980-01-02 /srv/gems/mvz-live_ast-2.3.0/lib/live_ast/linker.rb: ast = find_ast(*obj.source_location) or raise ASTNotFoundError 2025-12-02 /srv/gems/openproject-primer_view_components-0.78.1/app/lib/primer/experimental_render_helpers.rb: return yield(*args, **kwargs) if block&.source_location.nil? 2025-12-03 /srv/gems/primer_view_components-0.48.0/app/lib/primer/experimental_render_helpers.rb: return yield(*args, **kwargs) if block&.source_location.nil? 2024-12-30 /srv/gems/r_spec-clone-1.7.2/lib/r_spec/clone/dsl.rb: Logger.source(*block.source_location) 2024-12-30 /srv/gems/r_spec-clone-1.7.2/lib/r_spec/clone/dsl.rb: Logger.source(*block.source_location) 2010-09-06 /srv/gems/remote_logger-0.0.5/spec/spec_helper.rb: it description_from(*block.source_location), &block 2017-02-23 /srv/gems/respectable-0.3.3/lib/respectable.rb: instance_eval(<<-IT, *block.source_location) 2017-02-23 /srv/gems/respectable-0.3.3/lib/respectable.rb: eval(block.source, binding, *block.source_location) 2025-10-19 /srv/gems/scrapbook-0.4.0/vendor/ruby/2.7.0/gems/irb-1.4.1/lib/irb/workspace.rb: @binding = eval("IRB.conf[:__MAIN__].instance_eval('binding', __FILE__, __LINE__)", @binding, *@binding.source_location) 1980-01-02 /srv/gems/showcase-rails-0.5.0/app/models/showcase/sample.rb: source = extract_source_block_via_matched_indentation_from(*block.source_location) 2011-05-02 /srv/gems/sourcify-0.5.0/lib/sourcify/proc/parser.rb: @arity, @source_code = _proc.arity, SourceCode.new(*_proc.source_location(false)) 2018-11-12 /srv/gems/suture-1.1.2/lib/suture/error/verification_failed.rb: "Proc # (in: `#{describe_source_location(*comparator.source_location)}`)" 2018-11-12 /srv/gems/suture-1.1.2/lib/suture/error/verification_failed.rb: "#{comparator.inspect}.new, # (in: `#{describe_source_location(*comparator.method(:call).source_location)}`)" 2018-02-12 /srv/gems/tuttle-0.0.8/app/views/tuttle/rack_attack/index.html.erb: <dd><%= display_source_locaction(*Rack::Attack.blocklisted_response.source_location) %></dd> 2018-02-12 /srv/gems/tuttle-0.0.8/app/views/tuttle/rack_attack/index.html.erb: <dd><%= display_source_locaction(*Rack::Attack.throttled_response.source_location) %></dd> 2018-02-12 /srv/gems/tuttle-0.0.8/app/views/tuttle/rack_attack/index.html.erb: <%= display_source_locaction(*throttle.limit.source_location) %> 2018-02-12 /srv/gems/tuttle-0.0.8/app/views/tuttle/rack_attack/index.html.erb: <%= display_source_locaction(*throttle.period.source_location) %> 2018-02-12 /srv/gems/tuttle-0.0.8/app/views/tuttle/rack_attack/index.html.erb: <%= display_source_locaction(*throttle.block.source_location) %> 2018-02-12 /srv/gems/tuttle-0.0.8/app/views/tuttle/rack_attack/index.html.erb: <td><%= display_source_locaction(*safelist.block.source_location) %></td> 2018-02-12 /srv/gems/tuttle-0.0.8/app/views/tuttle/rack_attack/index.html.erb: <td><%= display_source_locaction(*blocklists.block.source_location) %></td> 2018-02-12 /srv/gems/tuttle-0.0.8/app/views/tuttle/rack_attack/index.html.erb: <td><%= display_source_locaction(*track.filter.block.source_location) rescue 'No Source Location' %></td> 2018-02-12 /srv/gems/tuttle-0.0.8/app/views/tuttle/rack_attack/index.html.erb: <td><%= display_source_locaction(*listener.instance_variable_get(:@delegate).source_location) rescue 'Unknown' %></td> 2018-02-12 /srv/gems/tuttle-0.0.8/app/views/tuttle/rails/index.html.erb: <td colspan="4"><code><%= display_source_locaction(*k.source_location) %></code></td> 2018-02-12 /srv/gems/tuttle-0.0.8/app/views/tuttle/rails/index.html.erb: <td colspan="4"><code><%= display_source_locaction(*k.source_location) %></code></td> 2023-09-05 /srv/gems/web-console-4.2.1/lib/web_console/evaluator.rb: "=> #{@binding.eval(input, *@binding.source_location).inspect}\n" 2011-11-11 /srv/gems/win-0.3.27/spec/spec_helper.rb: it description_from(caller[0]), &block # it description_from(*block.source_location), &block 2011-11-11 /srv/gems/win_gui-0.2.21/spec/spec_helper.rb: it description_from(*block.source_location), &block ``` ---------------------------------------- Feature #6012: Proc#source_location also return the column https://bugs.ruby-lang.org/issues/6012#change-115980 * Author: rogerdpack (Roger Pack) * Status: Closed * Assignee: nobu (Nobuyoshi Nakada) ---------------------------------------- As originally suggested in http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/42418 Suggestion/feature request: have #source_location also return the beginning column where it was defined. ["test.rb", 8, 33] Thanks! -roger- -- https://bugs.ruby-lang.org/
participants (1)
-
mame (Yusuke Endoh)