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

Crash session on autocomplete #455

Closed
vladimirtemnikov opened this issue Nov 21, 2022 · 1 comment
Closed

Crash session on autocomplete #455

vladimirtemnikov opened this issue Nov 21, 2022 · 1 comment

Comments

@vladimirtemnikov
Copy link

vladimirtemnikov commented Nov 21, 2022

Description

Hello.

There is a dry-logic 1.4.0 in my project which has Dry::Logic::Predicates::Methods#respond_to? custom method:

def respond_to?(method, input)
  input.respond_to?(method)
end

When I'm typing Anything.new. irb tries to get completions for instance of some class and crashes with the following error:

Backtrace
.bundle/ruby/3.1.0/gems/dry-logic-1.4.0/lib/dry/logic/predicates.rb:257:in `respond_to?': wrong number of arguments (given 1, expected 2) (ArgumentError)              █
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb/completion.rb:364:in `block in retrieve_completion_data'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb/completion.rb:362:in `each_object'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb/completion.rb:362:in `retrieve_completion_data'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb/completion.rb:161:in `block in <module:InputCompletor>'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline/line_editor.rb:1681:in `call_completion_proc_with_checking_args'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline/line_editor.rb:543:in `call_completion_proc_with_checking_args'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline.rb:226:in `block in <class:Core>'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline/line_editor.rb:588:in `instance_exec'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline/line_editor.rb:588:in `call'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline/line_editor.rb:623:in `call'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline/line_editor.rb:667:in `render_each_dialog'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline/line_editor.rb:651:in `block in render_dialog'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline/line_editor.rb:650:in `each'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline/line_editor.rb:650:in `render_dialog'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline/line_editor.rb:510:in `rerender'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline.rb:330:in `block (3 levels) in inner_readline'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline.rb:328:in `each'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline.rb:328:in `block (2 levels) in inner_readline'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline.rb:387:in `block in read_io'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline.rb:373:in `loop'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline.rb:373:in `read_io'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline.rb:326:in `block in inner_readline'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline.rb:324:in `loop'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline.rb:324:in `inner_readline'
	from .bundle/ruby/3.1.0/gems/reline-0.3.1/lib/reline.rb:254:in `readmultiline'
	from /Users/vladimirtemnikov/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/forwardable.rb:238:in `readmultiline'
	from /Users/vladimirtemnikov/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/forwardable.rb:238:in `readmultiline'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb/input-method.rb:422:in `gets'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb.rb:550:in `block (2 levels) in eval_input'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb.rb:779:in `signal_status'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb.rb:549:in `block in eval_input'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb/ruby-lex.rb:283:in `lex'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb/ruby-lex.rb:252:in `block (2 levels) in each_top_level_statement'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb/ruby-lex.rb:249:in `loop'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb/ruby-lex.rb:249:in `block in each_top_level_statement'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb/ruby-lex.rb:248:in `catch'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb/ruby-lex.rb:248:in `each_top_level_statement'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb.rb:568:in `eval_input'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb.rb:502:in `block in run'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb.rb:501:in `catch'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb.rb:501:in `run'
	from .bundle/ruby/3.1.0/gems/irb-1.5.0/lib/irb.rb:419:in `start'
	from .bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands/console/console_command.rb:70:in `start'
	from .bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands/console/console_command.rb:19:in `start'
	from .bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands/console/console_command.rb:102:in `perform'
	from .bundle/ruby/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from .bundle/ruby/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from .bundle/ruby/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from .bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/command/base.rb:69:in `perform'
	from .bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/command.rb:48:in `invoke'
	from .bundle/ruby/3.1.0/gems/railties-6.1.7/lib/rails/commands.rb:18:in `<main>'
	from .bundle/ruby/3.1.0/gems/bootsnap-1.14.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from .bundle/ruby/3.1.0/gems/bootsnap-1.14.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from bin/rails:4:in `<main>'

The problem started with irb 1.4.3

Result of irb_info

irb(main):001:0> irb_info
=>
Ruby version: 3.1.2
IRB version: irb 1.5.0 (2022-11-20)
InputMethod: RelineInputMethod with Reline 0.3.1
RUBY_PLATFORM: arm64-darwin21
LANG env: en_US.UTF-8
East Asian Ambiguous Width: 1

Terminal Emulator

iTerm2

Setting Files

None

@vladimirtemnikov
Copy link
Author

Will be fixed on dry-logic side.

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

1 participant