What version of Go are you using (go version)?
$ go version
go version go1.19.4 linux/amd64
Does this issue reproduce with the latest release?
Yes, also for tip.
What did you do?
package main
func main() {}
type C1 interface {
comparable
}
type C2 interface {
comparable
[2]any | int
}
func G1[T C1](t T) {}
func G2[T C2](t T) {}
func F1[V [2]any](v V) {
_ = G1[V] // error: V does not implement comparable
}
func F2[V [2]any](v V) {
_ = G2[V] // okay (but should not?)
}
What did you expect to see?
Both F1 and F2 fail to compile.
What did you see instead?
F2 compiles okay.
My understanding is that the type set of C2 only contains int, because [2]any is not strictly comparable, though my understanding might be wrong.
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes, also for tip.
What did you do?
What did you expect to see?
Both F1 and F2 fail to compile.
What did you see instead?
F2 compiles okay.
My understanding is that the type set of C2 only contains
int, because[2]anyis not strictly comparable, though my understanding might be wrong.