8000 String inference not working sporadically · Issue #679 · castwide/solargraph · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

String inference not working sporadically #679

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

Closed
alexrecuenco opened this issue Aug 24, 2023 · 2 comments
Closed

String inference not working sporadically #679

alexrecuenco opened this issue Aug 24, 2023 · 2 comments

Comments

@alexrecuenco
Copy link
alexrecuenco commented Aug 24, 2023

I was trying solargraph, and although on hover it tells me that x is a string, it is not providing method inference, however if I do b.x it does provide it

I tried in https://solargraph.org/demo

# This editor uses solargraph-rails to provide Ruby code completion.
# Code suggestions include the core Ruby library, local class and variable
# definitions, and hints from YARD documentation.
# Hit ctrl+space anywhere in code to get context-aware suggestions.

# Try entering `str.` and hitting ctrl+space to see String instance methods.

class A
  def x
    "-> { 3 }"
  end
end

b = A.new
x = b.x
b.x.ascii_only? # <-- provides type inference for b.x
x.#<ctrl+space> #... <-- doesn't provide inference of possible options for x (

Thank you for your time, I couldn't find any similar issue.

@castwide
Copy link
Owner
castwide commented Feb 1, 2025

This turned out to be a name resolution conflict between the local variable x and the method A#x while trying to infer types. The fix is on master and will be included in the next release.

@castwide
Copy link
Owner

Released in 0.52.0.

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

No branches or pull requests

2 participants
0