Skip to content

go/types: problem with alias type #28576

@griesemer

Description

@griesemer

The following code

package p

type F = func(T)

type T interface {
	m(F)
}

type t struct{}

func (t) m(F) {}

var _ T = &t{}

doesn't type-check:

y.go:13:11: cannot use &(t literal) (value of type *t) as T value in variable declaration: wrong type for method m

but the code is correct (replacing F with func(T) everywhere works).

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.early-in-cycleA change that should be done early in the 3 month dev cycle.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions