mirror of
https://github.com/golang/go.git
synced 2024-09-22 10:58:58 +00:00
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 <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
ff8115d1a1
commit
76dd01f457
@ -176,17 +176,14 @@ func operandString(x *operand, qf Qualifier) string {
|
|||||||
if hasType {
|
if hasType {
|
||||||
if x.typ != Typ[Invalid] {
|
if x.typ != Typ[Invalid] {
|
||||||
var intro string
|
var intro string
|
||||||
var tpar *TypeParam
|
|
||||||
if isGeneric(x.typ) {
|
if isGeneric(x.typ) {
|
||||||
intro = " of parameterized type "
|
intro = " of parameterized type "
|
||||||
} else if tpar = asTypeParam(x.typ); tpar != nil {
|
|
||||||
intro = " of type parameter "
|
|
||||||
} else {
|
} else {
|
||||||
intro = " of type "
|
intro = " of type "
|
||||||
}
|
}
|
||||||
buf.WriteString(intro)
|
buf.WriteString(intro)
|
||||||
WriteType(&buf, x.typ, qf)
|
WriteType(&buf, x.typ, qf)
|
||||||
if tpar != nil {
|
if tpar := asTypeParam(x.typ); tpar != nil {
|
||||||
buf.WriteString(" constrained by ")
|
buf.WriteString(" constrained by ")
|
||||||
WriteType(&buf, tpar.bound, qf) // do not compute interface type sets here
|
WriteType(&buf, tpar.bound, qf) // do not compute interface type sets here
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user