Skip to content

cmd/compile: embedding comparable is not considered in calculating type sets #51472

@zigo101

Description

@zigo101

What version of Go are you using (go version)?

$ go version
go version go1.18rc1 linux/amd64

What did you do?

package main

func main() {
	foo("Abc")
	foo([]byte{}) // compiles okay, but should not
}

type C interface {
	comparable
	[]byte | string
}
	
func foo[T C](x T) {}

What did you expect to see?

Fails to compile.

What did you see instead?

Compiles okay.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions