Project

General

Profile

Actions

Bug #5938

closed

irb crashes on 2nd level tab complete if Module#name returns regexp

Added by eagspoo (foo bar) almost 13 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
Backport:
[ruby-core:42244]

Description

ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]

Copy this into irb and press tab :)

module Foo
def self.name
/foo/
end
end
[1].first.

In irb/completion.rb line 177:

name = m.name (where m is the module)

later

/some|stuff/ =~ name

If name is a regexp, boom.

Probably

name = m.name

should be

name = m.name.to_s

Since if that causes an exception it is already handled and name is set to "" or it will be harmlessly converted to a string.
Or the next if condition should also have a being/rescue around it.

Actions

Also available in: Atom PDF

Like0
Like0Like0