aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/conversions.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-02-17 17:56:34 -0800
committerRobert Griesemer <gri@golang.org>2021-02-18 20:47:17 +0000
commit099374b55e8aed17d1e77a1084f8fb78ff2f8162 (patch)
treea93d6b9f5cd0c51a25b3072cddba372c85c850c0 /src/cmd/compile/internal/types2/conversions.go
parent653386a89a702b54bb01be893cfd30cddb0e6107 (diff)
downloadgo-099374b55e8aed17d1e77a1084f8fb78ff2f8162.tar.gz
go-099374b55e8aed17d1e77a1084f8fb78ff2f8162.zip
[dev.typeparams] cmd/compile/internal/types2: remove Type.Under method in favor of function
This removes the need for the aType embedded type and brings the types2.Type API in sync with the go/types.Type API. For reasons not fully understood yet, introducing the new under function causes a very long initialization cycle error, which doesn't exist in go/types. For now, circumvent the problem through a helper function variable. This CL also eliminates superflous (former) Under() method calls inside optype calls (optype takes care of this). Plus some minor misc. cleanups and comment adjustments. Change-Id: I86e13ccf6f0b34d7496240ace61a1c84856b6033 Reviewed-on: https://go-review.googlesource.com/c/go/+/293470 Reviewed-by: Robert Findley <rfindley@google.com> Trust: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/types2/conversions.go')
-rw-r--r--src/cmd/compile/internal/types2/conversions.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/compile/internal/types2/conversions.go b/src/cmd/compile/internal/types2/conversions.go
index c9603b263c..dc0621919e 100644
--- a/src/cmd/compile/internal/types2/conversions.go
+++ b/src/cmd/compile/internal/types2/conversions.go
@@ -90,8 +90,8 @@ func (x *operand) convertibleTo(check *Checker, T Type) bool {
// "x's type and T have identical underlying types if tags are ignored"
V := x.typ
- Vu := V.Under()
- Tu := T.Under()
+ Vu := under(V)
+ Tu := under(T)
if check.identicalIgnoreTags(Vu, Tu) {
return true
}
@@ -100,7 +100,7 @@ func (x *operand) convertibleTo(check *Checker, T Type) bool {
// have identical underlying types if tags are ignored"
if V, ok := V.(*Pointer); ok {
if T, ok := T.(*Pointer); ok {
- if check.identicalIgnoreTags(V.base.Under(), T.base.Under()) {
+ if check.identicalIgnoreTags(under(V.base), under(T.base)) {
return true
}
}
@@ -146,7 +146,7 @@ func isUintptr(typ Type) bool {
func isUnsafePointer(typ Type) bool {
// TODO(gri): Is this asBasic(typ) instead of typ.(*Basic) correct?
- // (The former calls typ.Under(), while the latter doesn't.)
+ // (The former calls under(), while the latter doesn't.)
// The spec does not say so, but gc claims it is. See also
// issue 6326.
t := asBasic(typ)