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/types: change in embedded type ordering on dev.typeparams branch #47352

Closed
mdempsky opened this issue Jul 22, 2021 · 4 comments
Closed

go/types: change in embedded type ordering on dev.typeparams branch #47352

mdempsky opened this issue Jul 22, 2021 · 4 comments
Milestone

Comments

@mdempsky
Copy link
Member

@mdempsky mdempsky commented Jul 22, 2021

The test program at https://play.golang.org/p/O5DRq3UlQRa currently prints type x.J interface{x.I; error}

But on dev.typeparams, since fe4f134, it prints type x.J interface{error; x.I}.

This broke a Google-internal test. I'm okay with fixing the test, but @findleyr suggested that maybe we should restore the original sort order. Filing the issue to decide.

/cc @griesemer @dominikh

@mdempsky mdempsky added this to the Go1.18 milestone Jul 22, 2021
@griesemer
Copy link
Contributor

@griesemer griesemer commented Jul 22, 2021

If this is an isolated incident, I vote for fixing the test. The print output is still deterministic, it's just that now it's based on source order rather than sort order.

We could just sort when printing, but then the output doesn't match the API order.

We could keep the (original) sorted order, but that would require a bit more work when sorting (we need to sort positions as well). It doesn't seem worth the effort. The go/types API doesn't make any guarantees with respect to the ordering of embedded interfaces, I believe.

Loading

@heschi
Copy link
Contributor

@heschi heschi commented Aug 12, 2021

Any further comments on this? If not, I'll change the test.

Loading

@griesemer
Copy link
Contributor

@griesemer griesemer commented Aug 12, 2021

Please change the test - this seems the easiest way forward.

Loading

@heschi
Copy link
Contributor

@heschi heschi commented Aug 12, 2021

OK. Close the bug if you like.

Loading

@griesemer griesemer closed this Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants