From 069e8474def314390ec12c96ff3e52d687e8245f Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 27 Mar 2014 15:47:04 -0700 Subject: [PATCH] go.tools/go/types: print meaningful panic for unknown expressions LGTM=iant R=iant CC=golang-codereviews https://golang.org/cl/81310045 --- go/types/expr.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/go/types/expr.go b/go/types/expr.go index 93a20140..db45b03c 100644 --- a/go/types/expr.go +++ b/go/types/expr.go @@ -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