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

x/tools/refactor/eg: when matching struct literals, abstract over the tagged/tagless forms #10987

Open
alandonovan opened this issue May 29, 2015 · 1 comment
Labels
Refactoring Issues related to refactoring tools Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@alandonovan
Copy link
Contributor

Equivalent struct literals may be written in several ways:
T{1, 2}
T{a: 1, b: 2}
T{b: 2, a: 1}
The 'eg' tool should allow a pattern using any of these forms to match any of these expressions. That means internally converting to the named form and doing name-based (not index-based) matching of subtrees. The output should be emitted in the same form as the original.

@alandonovan alandonovan self-assigned this May 29, 2015
@josharian
Copy link
Contributor

Also note that the T might not be present in the AST. It can be elided when the struct literal is part of a larger literal (struct, array, map) from which the type can be inferred.

@ianlancetaylor ianlancetaylor added this to the Unreleased milestone Jun 3, 2015
@stamblerre stamblerre changed the title refactor/eg: when matching struct literals, abstract over the tagged/tagless forms x/tools/refactor/eg: when matching struct literals, abstract over the tagged/tagless forms Apr 14, 2020
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Apr 14, 2020
@adonovan adonovan added the Refactoring Issues related to refactoring tools label Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactoring Issues related to refactoring tools Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

5 participants