Skip to content

go/types, types2: inference fails where it should succeed when considering interface methods #60564

@griesemer

Description

@griesemer

This code produces an error but we should be able to infer T in this case.

package p

type I[T any] interface {
	m(T)
}

func f5[T any](I[T]) {}

func _() {
	var x interface {
		m(int)
		n()
	}
	f5(x /* ERROR "type interface{m(int); n()} of x does not match inferred type I[int] for I[T]" */)
	f5[int](x) // ok
}

Not a release blocker as it doesn't work either in Go 1.20. But should fix if not too hard.

cc: @findleyr

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions