mirror of
https://github.com/golang/go
synced 2024-11-17 16:04:47 -07:00
cmd/compile: consistently use typekind when reporting invalid operation
While at it, make "typekind" awares of "types.Ideal*" types. Passes toolstash-check. Change-Id: I092fa8c57ab6b8d9ba0f25d8e1ea44fba48675e5 Reviewed-on: https://go-review.googlesource.com/c/go/+/256438 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
23573d0ea2
commit
754776850a
@ -151,8 +151,8 @@ var _typekind = []string{
|
||||
}
|
||||
|
||||
func typekind(t *types.Type) string {
|
||||
if t.IsSlice() {
|
||||
return "slice"
|
||||
if t.IsUntyped() {
|
||||
return fmt.Sprintf("%v", t)
|
||||
}
|
||||
et := t.Etype
|
||||
if int(et) < len(_typekind) {
|
||||
@ -736,7 +736,7 @@ func typecheck1(n *Node, top int) (res *Node) {
|
||||
t = mixUntyped(l.Type, r.Type)
|
||||
}
|
||||
if dt := defaultType(t); !okfor[op][dt.Etype] {
|
||||
yyerror("invalid operation: %v (operator %v not defined on %v)", n, op, t)
|
||||
yyerror("invalid operation: %v (operator %v not defined on %s)", n, op, typekind(t))
|
||||
n.Type = nil
|
||||
return n
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user