Skip to content

Adding selectors to index handling for generics #1376

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

Merged
merged 2 commits into from
Jun 16, 2025

Conversation

grantnelson-wf
Copy link
Collaborator

@grantnelson-wf grantnelson-wf commented Jun 10, 2025

In several cases we expected the target expression (e.g. e.X) of an indexer expression (i.e.IndexExp and IndexListExp) 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

@grantnelson-wf grantnelson-wf self-assigned this Jun 10, 2025
@grantnelson-wf grantnelson-wf marked this pull request as ready for review June 10, 2025 19:38
@grantnelson-wf grantnelson-wf marked this pull request as draft June 10, 2025 19:53
@grantnelson-wf grantnelson-wf marked this pull request as ready for review June 11, 2025 20:46
@grantnelson-wf grantnelson-wf merged commit 1e45615 into gopherjs:master Jun 16, 2025
10 checks passed
@grantnelson-wf grantnelson-wf deleted the indexedSel branch June 16, 2025 18:59
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

Successfully merging this pull request may close these issues.

2 participants