Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined method `match?' for ["Proc.to_proc", "Hash.to_proc"]:Array #609

Closed
ansonhoyt opened this issue Nov 20, 2023 · 3 comments
Closed

Comments

@ansonhoyt
Copy link

ansonhoyt commented Nov 20, 2023

Description

What are your expected behavior and actual behavior of your environment?

Given a Hash (a literal or variable), entering .to_ shows completions:

Screenshot 2023-11-20 at 1 17 33 PM

Expected:

Entering the Tab key should cycle through the available method completions that are shown.

Actual:

Entering Tab exists irb with an error:

/Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/irb-1.9.0/lib/irb/input-method.rb:315:in `block in show_doc_dialog_proc': undefined method `match?' for ["Proc.to_proc", "Hash.to_proc"]:Array (NoMethodError)
                 'a'}.to_s
        show_easter_egg = name&.match?(/\ARubyVM/) && !ENV['RUBY_YES_I_AM_NOT_A_NORMAL_USER']
                              ^^^^^^^^
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline/line_editor.rb:588:in `instance_exec'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline/line_editor.rb:588:in `call'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline/line_editor.rb:623:in `call'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline/line_editor.rb:776:in `update_each_dialog'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline/line_editor.rb:652:in `block in render_dialog'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline/line_editor.rb:650:in `map'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline/line_editor.rb:650:in `render_dialog'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline/line_editor.rb:500:in `rerender'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline.rb:351:in `block (3 levels) in inner_readline'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline.rb:349:in `each'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline.rb:349:in `block (2 levels) in inner_readline'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline.rb:424:in `block in read_io'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline.rb:394:in `loop'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline.rb:394:in `read_io'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline.rb:347:in `block in inner_readline'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline.rb:345:in `loop'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline.rb:345:in `inner_readline'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline.rb:273:in `block in readmultiline'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline/ansi.rb:152:in `block in with_raw_input'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline/ansi.rb:152:in `raw'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline/ansi.rb:152:in `with_raw_input'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/reline-0.4.0/lib/reline.rb:269:in `readmultiline'
	from /Users/ahoyt/.rvm/rubies/ruby-3.2.2/lib/ruby/3.2.0/forwardable.rb:240:in `readmultiline'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/irb-1.9.0/lib/irb/input-method.rb:449:in `gets'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/irb-1.9.0/lib/irb.rb:539:in `block in read_input'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/irb-1.9.0/lib/irb.rb:823:in `signal_status'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/irb-1.9.0/lib/irb.rb:537:in `read_input'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/irb-1.9.0/lib/irb.rb:559:in `readmultiline'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/irb-1.9.0/lib/irb.rb:586:in `block in each_top_level_statement'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/irb-1.9.0/lib/irb.rb:585:in `loop'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/irb-1.9.0/lib/irb.rb:585:in `each_top_level_statement'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/irb-1.9.0/lib/irb.rb:507:in `eval_input'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/irb-1.9.0/lib/irb.rb:494:in `block in run'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/irb-1.9.0/lib/irb.rb:493:in `catch'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/irb-1.9.0/lib/irb.rb:493:in `run'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/irb-1.9.0/lib/irb.rb:395:in `start'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/gems/irb-1.9.0/exe/irb:9:in `<top (required)>'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/bin/irb:25:in `load'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/bin/irb:25:in `<main>'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/bin/ruby_executable_hooks:22:in `eval'
	from /Users/ahoyt/.rvm/gems/ruby-3.2.2/bin/ruby_executable_hooks:22:in `<main>'

Terminal Emulator

What's your terminal emulator?

  • irb 1.9.0 with Ruby 3.2.2
  • iTerm2 3.4.22
  • GNU bash, version 3.2.57(1)-release (arm64-apple-darwin23)
  • (macOS 14.1 with an Apple M1 Max)
@ansonhoyt
Copy link
Author

ansonhoyt commented Nov 20, 2023

A slightly simpler reproduction is possible with an empty Hash literal then . then Tab:
Screenshot 2023-11-20 at 1 33 33 PM

will raise:

undefined method `match?' for ["Proc.parameters", "Hash.parameters"]:Array (NoMethodError)

@ima1zumi
Copy link
Member

Thank you for your report! This issue has been fixed by ruby/irb#764.

@ansonhoyt
Copy link
Author

I missed that PR, glad it is already fixed! 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants