Skip to content

cmd/compile: import issue with self-referential generic interface type #48280

@rogpeppe

Description

@rogpeppe
go version devel go1.18-b86e8dd0f3 Thu Sep 9 09:06:46 2021 +0000 linux/amd64

I see an unexpected error when I run go test on the following code:

-- p.go --
package p

type I[T I[T]] interface {
	F() T
}
-- p_test.go --
package p

import "testing"

func TestP(t *testing.T) {}

The error that I see is:

# github.com/rogpeppe/generic/set-bug
vet: ./p.go:3:10: I is not a generic type
# github.com/rogpeppe/generic/set-bug.test
/tmp/go-build1456973644/b001/_testmain.go:13:8: could not import github.com/rogpeppe/generic/set-bug (cannot import "github.com/rogpeppe/generic/set-bug" (type parameter bound more than once), possibly version skew - reinstall package)
FAIL	github.com/rogpeppe/generic/set-bug [build failed]

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.genericsIssue is related to genericsrelease-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions