diff --git a/src/pkg/go/types/expr.go b/src/pkg/go/types/expr.go index 5aacb02f86..8b645e4e20 100644 --- a/src/pkg/go/types/expr.go +++ b/src/pkg/go/types/expr.go @@ -293,6 +293,11 @@ func (check *checker) convertUntyped(x *operand, target Type) { // typed target switch t := underlying(target).(type) { + case nil: + // We may reach here due to previous type errors. + // Be conservative and don't crash. + x.mode = invalid + return case *Basic: check.isRepresentable(x, t) case *Interface: @@ -304,6 +309,7 @@ func (check *checker) convertUntyped(x *operand, target Type) { goto Error } default: + check.dump("x = %v, target = %v", x, target) // leave for debugging unreachable() }