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

Normalize declarations #30

Merged
merged 3 commits into from
Feb 28, 2023
Merged

Normalize declarations #30

merged 3 commits into from
Feb 28, 2023

Conversation

tehsphinx
Copy link
Member

Implements declaration normalization as suggested here: #26 (comment)

The cases it normalizes can best be seen in testdata/declarations or in the comment mentioned above. The basic idea is to use := declarations for everything and one line per declaration.

There is one case that could be normalized around declarations which this MR does NOT cover:

a, b, c := 1, "abc", struct{}{}
// could be normalized to
a := 1
b := "abc"
c := struct{}{}

@tehsphinx tehsphinx requested a review from a team as a code owner November 12, 2022 10:28
@tehsphinx
Copy link
Member Author

@junedev did you have a change to have a look?

@junedev
Copy link
Member

junedev commented Dec 7, 2022

@tehsphinx No, since I don't have a good grasp of AST parsing and the representer code, it would take me quite some time to do any kind of sensible review. Didn't have that time yet. I'm ok with this being waved through by the admins though as we anyway need to do some more testing before taking the whole thing live.

Copy link
Member

@junedev junedev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one point I noticed scrolling through: It would be great if the test cases could have names of what they check, e.g. that would make it easier to describe the normalizations in documentation later on. Also would be good to include a test case for the things we might not handle currently like var err error or var a SomeStruct to ensure that does not cause any issues in the representation.

@tehsphinx
Copy link
Member Author

tehsphinx commented Dec 10, 2022

@junedev I think the review could be mostly about checking the test cases (solution.go and representation.txt) if that is what we want.

The test names I think we can update in another MR (to keep things separate). Good point!

@junedev
Copy link
Member

junedev commented Feb 27, 2023

@ErikSchierboom Can you stamp this? The representer is not live yet and we can do more testing later.

Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

@junedev junedev merged commit e8a01a2 into main Feb 28, 2023
@junedev junedev deleted the normalize_declarations branch February 28, 2023 20:06
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.

3 participants