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:
parent
f35b5691f3
commit
069e8474de
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue