Skip to content

cmd/compile: incorrect program produces "invalid syntax tree" error #58612

@griesemer

Description

@griesemer
package main

func main() {
	var value = new(Demo)
	UseFunc[value.(type)]()
}

type Demo struct{}

func UseFunc[T any]() {}

produces 3 errors:

./prog.go:4:6: value declared and not used
./prog.go:5:10: value.(type) is not a type
./prog.go:5:10: invalid syntax tree: use of .(type) outside type switch

Only the 2nd error should be presented.

From #58608.

Metadata

Metadata

Assignees

Labels

NeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

Status

In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions