go.tools/go/types: print meaningful panic for unknown expressions

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/81310045
This commit is contained in:
Robert Griesemer 2014-03-27 15:47:04 -07:00
parent f35b5691f3
commit 069e8474de
1 changed files with 2 additions and 4 deletions

View File

@ -7,6 +7,7 @@
package types
import (
"fmt"
"go/ast"
"go/token"
"math"
@ -1386,10 +1387,7 @@ func (check *checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind {
// types, which are comparatively rare.
default:
if debug {
check.dump("expr = %v (%T)", e, e)
}
unreachable()
panic(fmt.Sprintf("%s: unknown expression type %T", check.fset.Position(e.Pos()), e))
}
// everything went well