aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-10-27 17:28:36 -0700
committerRobert Griesemer <gri@golang.org>2021-10-28 01:03:38 +0000
commit12dc48fd54d4bfc0c25e2a96aa7fecfacb9087ca (patch)
tree8d6d1fb3f9133ec9d2006486433618c7cddac154 /src/cmd
parenta91d0b649c9ee8c64328fb124eff94dfca300d39 (diff)
downloadgo-12dc48fd54d4bfc0c25e2a96aa7fecfacb9087ca.tar.xz
cmd/compile/internal/types2: export Structure function
For #48538. Change-Id: I258b0c8af5801692ad238e47397dde0b4e3c44c1 Reviewed-on: https://go-review.googlesource.com/c/go/+/359275 Trust: Robert Griesemer <gri@golang.org> Trust: Dan Scales <danscales@google.com> Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/compile/internal/types2/builtins.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/types2/builtins.go b/src/cmd/compile/internal/types2/builtins.go
index e8de0077d4..c5c6bdf0a5 100644
--- a/src/cmd/compile/internal/types2/builtins.go
+++ b/src/cmd/compile/internal/types2/builtins.go
@@ -767,6 +767,16 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
return true
}
+// Structure is exported for the compiler.
+
+// If typ is a type parameter, Structure returns the single underlying
+// type of all types in the corresponding type constraint if it exists,
+// or nil otherwise. If typ is not a type parameter, Structure returns
+// the underlying type.
+func Structure(typ Type) Type {
+ return structure(typ)
+}
+
// If typ is a type parameter, structure returns the single underlying
// type of all types in the corresponding type constraint if it exists,
// or nil otherwise. If typ is not a type parameter, structure returns