Skip to content

cmd/compile: failing type inference produces unclear error message #60542

@griesemer

Description

@griesemer

Taken from #60434:

package p

func Clip[S ~[]E, E any](s S) S {
	return s
}

var versions func()
var _ = Clip(versions)

produces:

/tmp/x.go:8:13: S does not match []E

which is not helpful.

Suggestion by @rsc :

It would be helpful to say what function is being called and what S is, as in:

/tmp/x.go:8:13: in call to slices.Clip, S (type func()) does not match []E

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.TypeInferenceIssue is related to generic type inferencecompiler/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