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

Go: add tests for dataflow relating to type aliasing #17400

Open
wants to merge 4 commits into
base: rc/3.15
Choose a base branch
from

Conversation

smowton
Copy link
Contributor

@smowton smowton commented Sep 6, 2024

No description provided.

@smowton smowton requested a review from a team as a code owner September 6, 2024 16:07
@github-actions github-actions bot added the Go label Sep 6, 2024
Copy link
Member

@mbg mbg left a comment

Choose a reason for hiding this comment

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

Looks reasonable. I have a couple of suggestions and one question, but nothing that blocks us from merging this.

@@ -0,0 +1,3 @@
module test.com/basename

go 1.22.5
Copy link
Member

Choose a reason for hiding this comment

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

Any difference if this is go 1.23.1?

Comment on lines +11 to +14
// Note trickery with packages is necessary so that Go will assign the fields the same name as well as the same type.

type EmbedsPkg1IntStruct = struct{ pkg1.IntStruct }
type EmbedsPkg2IntStruct = struct{ pkg2.IntStruct }
Copy link
Member

Choose a reason for hiding this comment

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

I think this part probably warrants a bit more explanation. What would happen without the package trickery? The comment implies that they will have different names and different types, but it's not immediately clear why that is or how it affects the test.

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a very artificial test, since I'm not sure why a package would define an alias without changing the name (just to avoid mentioning the original package?). More likely might be two packages with aliases with the same name for the same type. Would that test the same thing? Or be a separate test worth adding?

Comment on lines +3 to +4
// Tests that dataflow and interface implementation behave as expected when an interface
// is implemented using a non-equal but identical type, i.e. an equal type after alias resolution.
Copy link
Member

Choose a reason for hiding this comment

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

"Non-equal but identical" is a contradiction. Can we be more specific about the kinds of equality? Or perhaps we can get around the issue entirely with e.g.:

Suggested change
// Tests that dataflow and interface implementation behave as expected when an interface
// is implemented using a non-equal but identical type, i.e. an equal type after alias resolution.
// Tests that dataflow and interface implementation behave as expected when an interface
// is implemented using different type names, which resolve to the same underlying type.

@owen-mc
Copy link
Contributor

owen-mc commented Sep 10, 2024

This should be retargeted to main, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants