From: Robert Griesemer Date: Wed, 20 Oct 2021 20:12:43 +0000 (-0700) Subject: cmd/compile/internal/types2: reduce output when describing type parameters X-Git-Tag: go1.18beta1~799 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=76dd01f45786757a08f1e070245d174cd64559be;p=gostls13.git cmd/compile/internal/types2: reduce output when describing type parameters There's no need to say "type parameter" for a type parameter. The name is sufficient (they are always named), and the prose is followed by "constrained by". Change-Id: I98df8caa1432b8b7a874e58da6e3ed6be102b4a0 Reviewed-on: https://go-review.googlesource.com/c/go/+/357410 Trust: Robert Griesemer Run-TryBot: Robert Griesemer TryBot-Result: Go Bot Reviewed-by: Robert Findley --- diff --git a/src/cmd/compile/internal/types2/operand.go b/src/cmd/compile/internal/types2/operand.go index 19326b8342..a5b2729451 100644 --- a/src/cmd/compile/internal/types2/operand.go +++ b/src/cmd/compile/internal/types2/operand.go @@ -176,17 +176,14 @@ func operandString(x *operand, qf Qualifier) string { if hasType { if x.typ != Typ[Invalid] { var intro string - var tpar *TypeParam if isGeneric(x.typ) { intro = " of parameterized type " - } else if tpar = asTypeParam(x.typ); tpar != nil { - intro = " of type parameter " } else { intro = " of type " } buf.WriteString(intro) WriteType(&buf, x.typ, qf) - if tpar != nil { + if tpar := asTypeParam(x.typ); tpar != nil { buf.WriteString(" constrained by ") WriteType(&buf, tpar.bound, qf) // do not compute interface type sets here }