Adding selectors to index handling for generics #1376
Merged
+166
−22
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.
In several cases we expected the target expression (e.g.
e.X
) of an indexer expression (i.e.IndexExp
andIndexListExp
) to be an*ast.Ident
, which is not true for all cases. I wrote a test containing a bunch of the cases I could think of that would put a*ast. SelectorExpr
as the target expression of the indexer expression. Most of the unhandled cases were around calling an exported generic function from a different package, e.g.package.Foo[int]()
. This must have slipped through the cracks when we were doing other generic stuff since it isn't too common in tests (ours and Go's) to have multiple packages.I also fixed how exported functions are written to the package object. It was overwriting the package variable with the individual instances instead of setting the list of instances once.
This is related to #1013 and #1270