Commit 25c99300 authored by Robert Griesemer's avatar Robert Griesemer

go/types: don't crash if there are no hints

R=r
CC=golang-dev
https://golang.org/cl/7375060
parent 11776a39
...@@ -293,6 +293,11 @@ func (check *checker) convertUntyped(x *operand, target Type) { ...@@ -293,6 +293,11 @@ func (check *checker) convertUntyped(x *operand, target Type) {
// typed target // typed target
switch t := underlying(target).(type) { 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: case *Basic:
check.isRepresentable(x, t) check.isRepresentable(x, t)
case *Interface: case *Interface:
...@@ -304,6 +309,7 @@ func (check *checker) convertUntyped(x *operand, target Type) { ...@@ -304,6 +309,7 @@ func (check *checker) convertUntyped(x *operand, target Type) {
goto Error goto Error
} }
default: default:
check.dump("x = %v, target = %v", x, target) // leave for debugging
unreachable() unreachable()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment