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

Index return types using RBS #2327

Closed
Tracked by #1335
st0012 opened this issue Jul 18, 2024 · 2 comments
Closed
Tracked by #1335

Index return types using RBS #2327

st0012 opened this issue Jul 18, 2024 · 2 comments
Assignees

Comments

@st0012
Copy link
Member

st0012 commented Jul 18, 2024

No description provided.

@st0012
Copy link
Member Author

st0012 commented Jul 30, 2024

Some notes:

  • RBS' return values don't have variable names, just type names. The structure looks like:
    @return_type=
             #<RBS::Types::ClassInstance:0x0000000150b1cbb8
              @args=[#<RBS::Types::Variable:0x0000000150b1cc58 @location=#<RBS::Location:1190420 buffer=/Users/hung-wulo/.gem/ruby/3.3.4/gems/rbs-3.5.1/core/array.rbs, start=1139:54, pos=38639...38640, children= source="U">, @name=:U>],
              @location=#<RBS::Location:1190480 buffer=/Users/hung-wulo/.gem/ruby/3.3.4/gems/rbs-3.5.1/core/array.rbs, start=1139:46, pos=38631...38641, children=name,?args source="::Array[U]">,
              @name=#<RBS::TypeName:0x0000000150b1ccd0 @kind=:class, @name=:Array, @namespace=#<RBS::Namespace:0x0000000150b1ccf8 @absolute=true, @path=[]>>>,
            @trailing_positionals=[]>,
    
  • Ruby LSP currently doesn't store any RBS type information. In overloads we only store the parameter names
  • The return value information will more likely be used for type flow analysis, instead of being used to serve LSP requests

@st0012
Copy link
Member Author

st0012 commented Aug 27, 2024

After working with @Morriar to collect some numbers, chained method invocations on literals only appears very rarely (~0.15% among all method calls). So we decided the code addition in #2496 is not worth the cost of maintenance and the extra memory usage caused by indexing return types.

And since chained method inference on literals is the only use case for indexing RBS' return type atm, I'm closing this as well.

@st0012 st0012 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 27, 2024
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

1 participant