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

Local variable assignment being incorrectly recognised as debugging commands #803

Open
st0012 opened this issue Dec 5, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@st0012
Copy link
Member

st0012 commented Dec 5, 2023

Description

When assigning a local variable which's name is the same one of the debugging commands (e.g. info), it'd be treated as the command call instead of a local assignment:

irb(main):001> info = 123
`debug` command is only available when IRB is started with binding.irb
=> nil
@tompng
Copy link
Member

tompng commented Apr 4, 2024

We can check command-like assignment by regexp like /\A#{COMMAND_NAME} (=|\+=|-=|\*=|...)/

info = 123
info += 1
info <<= 1

Now, using local variable info seems hard because the code below will be treated as command

info + 1
info << 1
info > 42

But maybe this can be solved by extending the command-method override policy (NO_OVERRIDE OVERRIDE_ALL OVERRIDE_PRIVATE_ONLY) to also check local variables existence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants