-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Closed
Labels
BadErrorMessageIssues related compiler error messages that should be better.Issues related compiler error messages that should be better.BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
Compiling the following on the Go playground (go version 1.25; cf. https://go.dev/play/p/fTm-OR3aJ3a [2025-10-29])
package main
type S struct{}
func (S) G() {}
func main() {
var s S
_ = must(s.F())
}
func must[T any](x T, err error) T {
if err != nil {
panic(err)
}
return x
}
gives the rather thought-provoking two error messages:
./prog.go:10:11: not enough arguments in call to must
have (S)
want (T, error)
./prog.go:10:13: s.F undefined (type S has no field or method F)
Regarding the first one, I would have expected something along the lines of:
have (undefined)
Metadata
Metadata
Assignees
Labels
BadErrorMessageIssues related compiler error messages that should be better.Issues related compiler error messages that should be better.BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
Status
Done