Skip to content

go/types: inconsistent type checking results with recursive aliases on 1.22 and 1.23 #70230

Open
@timothy-king

Description

Opening a new issue for #50729 (comment) .

go/types is giving inconsistent errors with recursive aliases on this example https://go.dev/play/p/CO_3yd7yyrV :

type A = E[any]

type X interface {
	G(c A)
}

type E[T any] interface {
	L(A)
}

On the 1.22 playground this fails with the error:

./prog.go:12:4: invalid use of type alias A in recursive type (see go.dev/issue/50729)

Go build failed.

On the 1.23 playground, this fails with the error:

# [play]
vet: ./prog.go:12:4: invalid use of type alias A in recursive type (see go.dev/issue/50729)

Go vet failed.

Program exited.

gotip succeeds and outputs:

Program exited.

On 1.22 and 1.23, commenting out G(c A) makes the vet warning go away. As does moving the declaration of X below E.

cc @griesemer

Metadata

Labels

NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions