mirror of
https://github.com/golang/go
synced 2024-11-26 02:17:58 -07:00
go/types: don't crash if there are no hints
R=r CC=golang-dev https://golang.org/cl/7375060
This commit is contained in:
parent
11776a39a1
commit
25c99300b9
@ -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()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user