From: Cuong Manh Le Date: Tue, 22 Sep 2020 05:43:16 +0000 (+0700) Subject: cmd/compile: consistently use typekind when reporting invalid operation X-Git-Tag: go1.16beta1~974 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=754776850a62fa37ff6d68a8d5250497b2869b26;p=gostls13.git 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 Run-TryBot: Cuong Manh Le Reviewed-by: Matthew Dempsky TryBot-Result: Go Bot --- diff --git a/src/cmd/compile/internal/gc/typecheck.go b/src/cmd/compile/internal/gc/typecheck.go index 2c445567de..8e87fc9df0 100644 --- a/src/cmd/compile/internal/gc/typecheck.go +++ b/src/cmd/compile/internal/gc/typecheck.go @@ -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 }