Bug #2427

possible bug in Method#source_location (from [ruby-core:27014])

Added by ujihisa . about 5 years ago. Updated almost 4 years ago.

Status:Closed
Priority:Normal
Assignee:Yusuke Endoh
ruby -v:ruby 1.9.2dev (2009-11-11 trunk 25717) [i386-mingw32] Backport:

Description

=begin
Originally reported by Roger Pack:

It appears that Method#source_location returns different values for
1.9.1 and 1.9.2dev for this code:

class A

def go( a=3,
b=3)
end
end
puts A.instance_method(:go).source_location

1.9.1 says line 3, 1.9.2 says line 4.

I assume 1.9.1 is correct? (I would expect it to be the line it
starts on, and if you take out the default values, both 1.9.1 and
1.9.2 says line 3).
Thanks.
-r

According to Luis Lavena's report,

a.rb, ending either with LF or CRLF:

C:\Users\Luis\Desktop>pik tags yarv ruby a.rb
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]

a.rb
3

ruby 1.9.2dev (2009-11-11 trunk 25717) [i386-mingw32]

a.rb
4

But I couldn't reproduce the issue on Mac OS X. Both LF and CRLF scripts said the same results.

In my environment, both versions of ruby said same results.

$ ruby191 -v a.rb
ruby 1.9.1p281 (2009-08-09 revision 24476) [i386-darwin9.7.0]
a.rb
4

$ ruby192 -v a.rb
ruby 1.9.2dev (2009-12-04 trunk 25986) [i386-darwin9.8.0]
a.rb
4
=end

Associated revisions

Revision 25992
Added by Nobuyoshi Nakada about 5 years ago

  • parse.y (k_def): adjust the location of method definition to the line of def. [Bug #2427]

Revision 25992
Added by Nobuyoshi Nakada about 5 years ago

  • parse.y (k_def): adjust the location of method definition to the line of def. [Bug #2427]

History

#1 Updated by Usaku NAKAMURA about 5 years ago

  • Assignee changed from Usaku NAKAMURA to Nobuyoshi Nakada

=begin
I don't know whether 3 or 4 is correct.

Anyway, this difference is brought by the changes of parse.y,
and not depends on the platform of ruby.
It depends on only revision.
I don't track the changes of parse.y, so I don't know the actual
revision which brings this difference.
In my expectation, Nobu knows everything about it.
=end

#2 Updated by Usaku NAKAMURA about 5 years ago

  • Assignee changed from Nobuyoshi Nakada to Yusuke Endoh

=begin
Oops, maybe not nobu, but mame.
=end

#3 Updated by Nobuyoshi Nakada about 5 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r25992.
ujihisa, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Also available in: Atom PDF