-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
$ go version
go version devel +150bd4ffd4 Wed Sep 23 07:51:17 2020 +0000 linux/amd64
$ cat recursive.go
package p
type T1 struct {
f2 T2
}
type T2 struct {
f1 T1
}
$ go build recursive.go
# command-line-arguments
./recursive.go:7:6: invalid recursive type T2
$ go build -o gotype $(go env GOROOT)/src/go/types/gotype.go
$ ./gotype recursive.go
recursive.go:3:6: illegal cycle in declaration of T1
recursive.go:3:6: T1 refers to
recursive.go:7:6: T2 refers to
recursive.go:3:6: T1
I had a cyclic type involving four types across three files, so I really did have to reach for gotype
to understand what was going on. I think we should improve the compiler's typechecker to provide a similarly detailed error.
griesemer and cuonglm
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.