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

cmd/compile: false positive error about recursive type aliases #23055

Closed
mdempsky opened this issue Dec 8, 2017 · 4 comments
Closed

cmd/compile: false positive error about recursive type aliases #23055

mdempsky opened this issue Dec 8, 2017 · 4 comments

Comments

@mdempsky
Copy link
Member

@mdempsky mdempsky commented Dec 8, 2017

cmd/compile erroneously emits an "invalid recursive type alias" error for:

package p

type a struct { b }
type b = c
type c struct { *b }

Related: #18640

@mdempsky mdempsky added this to the Go1.11 milestone Dec 8, 2017
@rasky rasky added the NeedsFix label Dec 8, 2017
@JicLotus

This comment has been minimized.

Copy link

@JicLotus JicLotus commented Dec 10, 2017

Hi, i want to take this issue.

@mdempsky

This comment has been minimized.

Copy link
Member Author

@mdempsky mdempsky commented Dec 11, 2017

@JicLotus Thanks for volunteering. If you'd like to work on this, feel free. I do want to caution though that this is likely to be a fairly subtle and involved part of the compiler.

The problem is that we recursively evaluate type declarations as needed. I think we'll need to undo this and instead evaluate type declarations in a two pass algorithm:

  1. Set up a TFORW type for each package-scoped declared type and associate the Sym with that type.
  2. Resolve each type declaration and assign the TFORW type's underlying type.

I'm suspecting we'll also have to split constant evaluation into a separate pass too. I briefly touched on this idea in #13890 (comment). But it might be possible to fix this issue without doing that.

@JicLotus

This comment has been minimized.

Copy link

@JicLotus JicLotus commented Dec 11, 2017

Great @mdempsky

@griesemer

This comment has been minimized.

Copy link
Contributor

@griesemer griesemer commented May 31, 2018

I'm going to close this one as it is fundamentally a duplicate of #18640 (which has been reopened); see here.

@griesemer griesemer closed this May 31, 2018
@golang golang locked and limited conversation to collaborators May 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.