Skip to content

reflect: reflect.Type does not implement comparable #54064

Closed as not planned
Closed as not planned
@oakad

Description

@oakad

Indeed:

func P[K comparable](d K) {
	fmt.Println(d)
}

func main() {
	d := reflect.TypeOf(int64(0))
	P(d)
}

I believe the above should work per the:

Type values are comparable, such as with the == operator, so they can be used as map keys. Two Type values are equal if they represent identical types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions