Skip to content

cmd/compile: named type constraints that are not interfaces are not automatically embedded in implicit interfaces #50450

@griesemer

Description

@griesemer

Test case:

func f[P ~int]() {}
func g[P int]() {}

var _ = f[int] // this is ok
var _ = g[int] // <<< ERROR int is not an interface

Per the spec, the declaration and instantiation of g should be valid.

Not a release blocker because one can always manually wrap the constraint as in:

package p

func f[P ~int]() {}
func g[P interface{int}]() {} // wrap in interface{}

var _ = f[int] // this is ok
var _ = g[int] // ok now

cc: @findleyr

Metadata

Metadata

Assignees

No one assigned

    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