Project

General

Profile

Actions

Bug #22709

open

The `source_location` line of "stabby lambdas" should be the line where `->` is

Bug #22709: The `source_location` line of "stabby lambdas" should be the line where `->` is

Added by byroot (Jean Boussier) about 5 hours ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:127812]

Description

Creating a new issue because [Bug #21784] was about columns which are still being discussed, here it's about lines, already available on all rubies.

Reproduction

block = ->(
  a = 1,
  b = "2" + 3
) do # line 4 is here
  :here
end
p block.source_location.last # => 4
block.call # TypeError /tmp/r.rb:3

I would expect source_location.last to return 1 (the line of ->).

Proposed patch: https://github.com/ruby/ruby/pull/20435


Related issues 1 (0 open — 1 closed)

Related to Ruby - Bug #21784: Proc#source_location start column seems strange for -> {}ClosedEregon (Benoit Daloze)Actions
Actions

Also available in: PDF Atom