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: missing T.m is a field, not a method error upon assignments to interfaces #51025

Open
griesemer opened this issue Feb 5, 2022 · 0 comments
Assignees
Labels
NeedsFix
Milestone

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Feb 5, 2022

The 1.17 compiler did report this extra error. See fixedbugs/bug231.go for a test case.

package main

type I interface{ m() }
type T struct{ m func() }
type M struct{}

func (M) m() {}

func main() {
	var t T
	var m M
	var i I

	i = m
	// types2 does not give extra error "T.m is a field, not a method"
	i = t // ERROR "not a method|has no methods|does not implement I"
	_ = i
}

cc: @findleyr

@griesemer griesemer added the NeedsFix label Feb 5, 2022
@griesemer griesemer added this to the Go1.19 milestone Feb 5, 2022
@griesemer griesemer self-assigned this Feb 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix
Projects
None yet
Development

No branches or pull requests

1 participant