From: Robert Griesemer Date: Wed, 27 Feb 2013 23:22:14 +0000 (-0800) Subject: go/types: don't crash if there are no hints X-Git-Tag: go1.1rc2~799 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=25c99300b9316e5a983af421d4d1a180b7aabf3a;p=gostls13.git go/types: don't crash if there are no hints R=r CC=golang-dev https://golang.org/cl/7375060 --- 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() }