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, types2: print instantiated types with package qualification in type cycles spanning external packages #50788

Closed
griesemer opened this issue Jan 24, 2022 · 2 comments
Assignees
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

This is a reminder issue to fix the printing of external instantiated packages (as reported with cycle errors) that contribute to invalid type cycles. Add corresponding tests.

See Checker.validType implementation, when we call check.cycleError(path[i:]) for a cycle that spans important instantiated types.

cc: @findleyr

@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Jan 24, 2022
@griesemer griesemer added this to the Go1.19 milestone Jan 24, 2022
@griesemer griesemer self-assigned this Jan 24, 2022
@griesemer
Copy link
Contributor Author

Example:

package main

import "playground/a"

type Q a.T[Q]

func main() {
}
-- go.mod --
module playground
-- a/a.go --
package a

type T[P any] struct {
	_ P
}

reports:

./prog.go:5:6: invalid recursive type Q
	./prog.go:5:6: Q refers to
	./prog.go:5:9: T refers to
	./prog.go:5:6: Q

It should print T as a.T

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/413895 mentions this issue: go/types, types2: print qualified object names in cycle errors

jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
Fixes golang#50788.

Change-Id: Id1ed7d9c0687e3005e28598373fd5634178c78ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/413895
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
@golang golang locked and limited conversation to collaborators Jun 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
Status: Done
Development

No branches or pull requests

2 participants