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

Sorbet.run cannot find usage of enum #4711

Closed
rgrasell-stripe opened this issue Oct 11, 2021 · 0 comments · Fixed by #7092
Closed

Sorbet.run cannot find usage of enum #4711

rgrasell-stripe opened this issue Oct 11, 2021 · 0 comments · Fixed by #7092
Labels
bug Something isn't working good first issue Good for newcomers IDE Relating to Sorbet's LSP server or VS Code extension

Comments

@rgrasell-stripe
Copy link

rgrasell-stripe commented Oct 11, 2021

Input

→ View on sorbet.run

# typed: true

class MyEnum < T::Enum
  enums do
    X = new
  # ^ def: X
  end
end

puts(MyEnum::X)
#            ^ usage: X

Observed output

Sorbet finds the definition of X = new as a reference, but not non-definition usage.

Expected behavior

Find all references on the enum definition on Sorbet.run should find the usage.

The above is a valid Sorbet LSP test case which currently fails but should pass:

test/lsp_test_runner.cc:301:
TEST CASE:  LSPTest

test/testdata/lsp/find_refs_enum.rb:10: ERROR: Sorbet did not report a reference to symbol `X`.
Given symbol at:
5:     X = new
       ^
Sorbet did not report reference at:
10: puts(MyEnum::X)
                 ^

test/testdata/lsp/find_refs_enum.rb:10: ERROR: Sorbet did not report a highlight to symbol `X`.
Given symbol at:
5:     X = new
       ^
Sorbet did not report highlight at:
10: puts(MyEnum::X)
                 ^

===============================================================================
[doctest] test cases:      1 |      0 passed |      1 failed |      0 skipped
[doctest] assertions:     93 |     91 passed |      2 failed |
[doctest] Status: FAILURE!
================================================================================
Target //test:test_LSPTests/testdata/lsp/find_refs_enum up-to-date:
  bazel-bin/test/test_LSPTests/testdata/lsp/find_refs_enum
@rgrasell-stripe rgrasell-stripe added bug Something isn't working unconfirmed This issue has not yet been confirmed by the Sorbet team labels Oct 11, 2021
@jez jez added good first issue Good for newcomers IDE Relating to Sorbet's LSP server or VS Code extension and removed unconfirmed This issue has not yet been confirmed by the Sorbet team labels Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers IDE Relating to Sorbet's LSP server or VS Code extension
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants