From 25c99300b9316e5a983af421d4d1a180b7aabf3a Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Wed, 27 Feb 2013 15:22:14 -0800 Subject: [PATCH] go/types: don't crash if there are no hints R=r CC=golang-dev https://golang.org/cl/7375060 --- src/pkg/go/types/expr.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pkg/go/types/expr.go b/src/pkg/go/types/expr.go index 5aacb02f862..8b645e4e20f 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() }