Issue #5938 has been reported by foo bar.

----------------------------------------
Backport #5938: irb crashes on 2nd level tab complete if Module#name returns regexp
https://bugs.ruby-lang.org/issues/5938

Author: foo bar
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


>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.


-- 
http://bugs.ruby-lang.org/