mirror of
https://github.com/golang/go
synced 2024-09-29 20:14:29 -06:00
[dev.typeparams] cmd/compile/internal/types2: print constraint info for type param operands
Change-Id: Ic7a249fc150b526835db744431bef500c20fbd26 Reviewed-on: https://go-review.googlesource.com/c/go/+/338309 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
aa3d54da07
commit
283991bd7f
@ -176,16 +176,20 @@ 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
|
||||||
switch {
|
var tpar *TypeParam
|
||||||
case isGeneric(x.typ):
|
if isGeneric(x.typ) {
|
||||||
intro = " of generic type "
|
intro = " of parameterized type "
|
||||||
case asTypeParam(x.typ) != nil:
|
} else if tpar = asTypeParam(x.typ); tpar != nil {
|
||||||
intro = " of type parameter type "
|
intro = " of type parameter "
|
||||||
default:
|
} 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 {
|
||||||
|
buf.WriteString(" constrained by ")
|
||||||
|
WriteType(&buf, tpar.bound, qf) // do not compute interface type sets here
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
buf.WriteString(" with invalid type")
|
buf.WriteString(" with invalid type")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user