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

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

Open
4ad opened this issue Aug 20, 2021 · 2 comments
Open

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

4ad opened this issue Aug 20, 2021 · 2 comments
Assignees
Milestone

Comments

@4ad
Copy link
Member

@4ad 4ad commented Aug 20, 2021

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
@mknyszek
Copy link
Contributor

@mknyszek mknyszek commented Aug 20, 2021

@griesemer griesemer self-assigned this Aug 22, 2021
@griesemer
Copy link
Contributor

@griesemer griesemer commented Aug 22, 2021

This is a type checker (types2) failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants