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

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

alandonovan opened this issue May 29, 2015 · 1 comment


Copy link

commented May 29, 2015

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


This comment has been minimized.

Copy link

commented May 29, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.