-
-
Notifications
You must be signed in to change notification settings - Fork 355
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
fix: Fix dropping diamonds on constructor calls #3362
Merged
monperrus
merged 11 commits into
INRIA:master
from
slarse:issue/3360-fix-dropped-diamonds
May 8, 2020
Merged
fix: Fix dropping diamonds on constructor calls #3362
monperrus
merged 11 commits into
INRIA:master
from
slarse:issue/3360-fix-dropped-diamonds
May 8, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In the case that the expected type is known, the arguments can also be recovered
NoClasspath is in the method name
…ed but context is not
Why does this keep happening? The odd line suddenly gets spaces instead of tabs...
I had some problems occurr in Spork due to duplicated references
slarse
changed the title
WIP: fix: Fix Spoon sometimes dropping <> on constructor calls
review: fix: Fix Spoon sometimes dropping <> on constructor calls
May 7, 2020
I'm pretty happy with this now, it appears to work for my purposes. None of the cases where I lost I'm unsure about the use of the |
LGTM, will merge. |
monperrus
changed the title
review: fix: Fix Spoon sometimes dropping <> on constructor calls
fix: Fix dropping diamonds on constructor calls
May 8, 2020
Thanks @slarse well done |
Happy to contribute! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #3360
This is an attempt to fix the problem discussed in #3360
What I do here is essentially to try to recover the type arguments from the
AllocationExpression
's expected type. To the best of my knowledge, empty diamonds are only allowed on constructor calls, so I only have an assert that the stack's top element is anAllocationExpression
. It shouldn't be possible for it to be anything else.If the constructor call occurs inside of an unresolved method, or another constructor call, then the
AllocationExpression
doesn't have an expected type (because it can't be resolved). In that case, I add the newOMITTED_TYPE_ARG_TYPE
(name could use some work) to the type argument list so at least Spoon can detect that the constructor is in fact parameterized, and will then print<>
.This appears to work as intended, but I'll be running some more tests locally with my merge tool to see if other issues crop up.