Skip to content

go/types: specious "invalid recursive type" error? #60130

Open
@mdempsky

Description

Given:

package p

type s struct { i i }
type i interface { s | any }

go/types currently reports:

/tmp/y.go:3:6: invalid recursive type s
/tmp/y.go:3:6: 	s refers to
/tmp/y.go:4:6: 	i refers to
/tmp/y.go:3:6: 	s

Notably, changing the field type from i to *i makes the error go away. I don't see any fundamental reason why that should make a difference though.

Synthetic test case, constructed while trying to write additional test cases for #60117.

/cc @adonovan @findleyr @griesemer @ianlancetaylor

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.early-in-cycleA change that should be done early in the 3 month dev cycle.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions