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: when reporting cycles, be more faithful to source code (UX improvement) #34771

Closed
griesemer opened this issue Oct 8, 2019 · 1 comment

Comments

@griesemer
Copy link
Contributor

For

type (
	A2 [10]A3
	A3/* ERROR cycle */ [10]A4
	A4 A2
)

go/types reports:

    check_test.go:271: /Users/gri/tmp/c.go:40:2: illegal cycle in declaration of A3
    check_test.go:271: /Users/gri/tmp/c.go:40:2:        A3 refers to
    check_test.go:271: /Users/gri/tmp/c.go:41:2:        A4 refers to
    check_test.go:271: /Users/gri/tmp/c.go:40:2:        A3

which seems misleading. This is due to the fact that type A4 A2 resolves to type A4 [10]A3. Note that cmd/compile does the same.

We could possibly report the cycle starting at A2 if we were to keep an additional link with each defined type, next to the resolved, underlying type.

This is a UX improvement.

@griesemer griesemer added this to the Unplanned milestone Oct 8, 2019
@griesemer griesemer self-assigned this Oct 8, 2019
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/199937 mentions this issue: go/types: don't skip defined types when reporting cycles

@golang golang locked and limited conversation to collaborators Oct 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants