Skip to content

cmd/compile: suppress typecheck errors in a type switch case with broken type #28926

@josharian

Description

@josharian
package p

func f(e interface{}) {
	switch e := e.(type) {
	case T:
		e.M()
	}
}
$ go tool compile x.go
x.go:5:7: undefined: T
x.go:6:4: e.M undefined (type interface {} is interface with no methods)

The first error message is accurate and helpful. We should suppress the second error message, which is confusing.

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