Skip to content

go/types: type mismatch with func error less helpful since go 1.18 #73428

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

Open
gnojus opened this issue Apr 17, 2025 · 2 comments
Open

go/types: type mismatch with func error less helpful since go 1.18 #73428

gnojus opened this issue Apr 17, 2025 · 2 comments
Labels
BugReport Issues describing a possible bug in the Go implementation. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@gnojus
Copy link

gnojus commented Apr 17, 2025

Go version

go version go1.24.2 linux/amd64

Output of go env in your module/workspace:

N/A

What did you do?

This like #57160, but with func instead of pointers:

package p

func _() {
	if foo < bar {
	}
}

func foo() {}
const bar = 0

What did you see happen?

./main.go:4:11: cannot convert bar (untyped int constant 0) to type func()

But even if you could convert it to func(), it's not comparable with <

What did you expect to see?

Like go 1.17:

./main.go:4:9: invalid operation: foo < bar (mismatched types func() int and int)
@gabyhelp
Copy link

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label Apr 17, 2025
@prattmic
Copy link
Member

cc @golang/compiler

@prattmic prattmic added this to the Backlog milestone Apr 18, 2025
@prattmic prattmic added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugReport Issues describing a possible bug in the Go implementation. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants