]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/types2: export Structure function
authorRobert Griesemer <gri@golang.org>
Thu, 28 Oct 2021 00:28:36 +0000 (17:28 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 28 Oct 2021 01:03:38 +0000 (01:03 +0000)
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>
src/cmd/compile/internal/types2/builtins.go

index e8de0077d40deae07df9333044398dcee071bcb6..c5c6bdf0a5df1cb71d224a6d7636f4f13bab960d 100644 (file)
@@ -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