Skip to content

cmd/compile: nonsensical error message with recursive generic interfaces #47837

@4ad

Description

@4ad

This is a follow-up to #47836, see that issue first.

On tip (e9e0d1e) with -gcflags=-G=3.

Repro:

package p

type F[t F] interface {
	B() t
}

type Int0 int
type Int1 int

func (n Int0) B() Int1 { return Int1(n) }
func (n Int1) B() Int0 { return Int0(n) }

func id[t F[t]](v t) t { return v }

var _ = id(Int0(42))

Compiler rejects it with:

go build -gcflags=-G=3 j.go
# command-line-arguments
./j.go:15:11: Int0 does not satisfy F[t]: wrong method signature
	got  func (Int0).B() Int1
	want func (F[t ○string]).B() Int0

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.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions