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