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

Improve definition handling for guessed receiver types #2472

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Aug 20, 2024

It's not uncommon for Ruby programmers to name variables after a class's superclass. But with guessed receiver types, such usages would actually reduce the number of definitions returned.

For example, given the following code:

class Animal
end

class Cat < Animal
  def meow
    "Meow"
  end
end

animal = Cat.new
animal.meow # meow can't be found with experimented features enabled

This commit improves the definition handling for guessed receiver types by treating them as unknown when no methods are found.

It's not uncommon for Ruby programmers to name variables after a class's
superclass. But with guessed receiver types, such usages would actually
reduce the number of definitions returned.

For example, given the following code:

```rb
class Animal
end

class Cat < Animal
  def meow
    "Meow"
  end
end

animal = Cat.new
animal.meow # meow can't be found with experimented features enabled
```

This commit improves the definition handling for guessed receiver types
by treating them as unknown when no methods are found.
@st0012 st0012 added the bugfix This PR will fix an existing bug label Aug 20, 2024
@st0012 st0012 self-assigned this Aug 20, 2024
@st0012 st0012 requested a review from a team as a code owner August 20, 2024 20:35
@st0012 st0012 requested review from andyw8 and vinistock August 20, 2024 20:35
@st0012 st0012 added the server This pull request should be included in the server gem's release notes label Aug 20, 2024
@st0012 st0012 merged commit 30e66ca into main Aug 20, 2024
34 of 35 checks passed
@st0012 st0012 deleted the improve-guessed-type-definition branch August 20, 2024 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants