Skip to content

cmd/compile: "missing method" diagnostic can be confusing when methods aren't promoted due to ambiguity #57352

@maxatome

Description

@maxatome

What version of Go are you using (go version)?

$ go version
go version go1.19.4 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

playground

What did you do?

package main

type A interface {
	a()
}

type AB interface {
	A
	b()
}

type Foo struct {
	A
	AB
}

func main() {
	var _ AB = Foo{}
}

https://go.dev/play/p/_SQyOJ_n2qv

What did you expect to see?

Either no error or an error saying that Foo has 2 a methods.

What did you see instead?

./prog.go:18:13: cannot use Foo{} (value of type Foo) as type AB in variable declaration:
	Foo does not implement AB (missing a method)

I didn't find this case in spec, but the message seems wrong.

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions