-
Notifications
You must be signed in to change notification settings - Fork 565
Desugar multiple assignment such that it returns rhs #984
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
Conversation
We were not being faithful to what Ruby does with our multiple assignment desugar. We were returning the result of a call to our magic expand splat method which is almost always not what actually happens at runtime. Here is the result of the attached test case before this commit: ```ruby extend T::Sig sig {returns(T.nilable(T::Array[Integer]))} def foo nil end T.reveal_type((a, b = foo)) # Revealed type: T.any(T::Array[Integer], [NilClass, NilClass]) T.reveal_type((c, *, d = 100)) # Revealed type: [Integer(100), NilClass] (2-tuple) ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you take the example from #981 and make it a test?
Ah sorry I missed it in the scroll back. It's there thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One suggestion, but other than that, this looks great, thanks!
Co-Authored-By: Jake Zimmerman <zimmerman.jake@gmail.com>
We were not being faithful to what Ruby does with our multiple
assignment desugar. We were returning the result of a call to our magic
expand splat method which is almost always not what actually happens at
runtime.
Here is the result of the attached test case before this commit:
Motivation
Fix #981 and be more faithful.
Test plan
See included automated tests.