diff options
author | Robert Griesemer <gri@golang.org> | 2021-12-03 12:20:33 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-12-04 04:41:31 +0000 |
commit | cd5f2cf50f6372e31dde0b407c1c3be57a2ce90f (patch) | |
tree | ba1a20b14e35e1cdcd189e55d19be0b6b3de1b42 /doc | |
parent | fa88ba1e8adacda08973d112cca8d6e66c1390e1 (diff) | |
download | go-cd5f2cf50f6372e31dde0b407c1c3be57a2ce90f.tar.gz go-cd5f2cf50f6372e31dde0b407c1c3be57a2ce90f.zip |
doc/go1.18: add documentation for changes to go/types
The number of involved CLs is too large (hundreds) so
no CLs are mentioned in (html) comments.
Updates #47694
Change-Id: I655d800a1e56a71e9d70a190f1c42c17baf6861e
Reviewed-on: https://go-review.googlesource.com/c/go/+/369099
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/go1.18.html | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/doc/go1.18.html b/doc/go1.18.html index c2a04ef419..fb0b054e28 100644 --- a/doc/go1.18.html +++ b/doc/go1.18.html @@ -451,6 +451,93 @@ Do not send CLs removing the interior tags from such phrases. </dd> </dl> +<dl id="go/types"><dt><a href="/pkg/go/types/">go/types</a></dt> + <dd> + <p><!-- https://golang.org/issue/47916 --> + Per the proposal + <a href="https://go.googlesource.com/proposal/+/master/design/47916-parameterized-go-types.md"> + Additions to go/types to support type parameters + </a> + the following additions are made to the <a href="/pkg/go/types"><code>go/types</code></a> package: + </p> + <ul> + <li> + The new type + <a href="/pkg/go/types/#TypeParam"><code>TypeParam</code></a>, factory function + <a href="/pkg/go/types/#NewTypeParam"><code>NewTypeParam</code></a>, + and associated methods were added to represent a type parameter. + </li> + <li> + The new type + <a href="/pkg/go/types/#TypeParamList"><code>TypeParamList</code></a> holds a list of + type parameters. + </li> + <li> + The new type + <a href="/pkg/go/types/#TypeList"><code>TypeList</code></a> and factory function + <a href="/pkg/go/types/#NewTypeList"><code>NewTypeList</code></a> facilitate storing + a list of types. + </li> + <li> + The new factory function + <a href="/pkg/go/types/#NewSignatureType"><code>NewSignatureType</code></a> allocates a + <a href="/pkg/go/types/#Signature"><code>Signature</code></a> with + (receiver or function) type parameters. + To access those type parameters, the <code>Signature</code> type has two new methods + <a href="/pkg/go/types/#Signature.RecvTypeParams"><code>Signature.RecvTypeParams</code></a> and + <a href="/pkg/go/types/#Signature.TypeParams"><code>Signature.TypeParams</code></a>. + </li> + <li> + <a href="/pkg/go/types/#Named"><code>Named</code></a> types have four new methods: + <a href="/pkg/go/types/#Named.Origin"><code>Named.Origin</code></a> to get the original + parameterized types of instantiated types, + <a href="/pkg/go/types/#Named.TypeArgs"><code>Named.TypeArgs</code></a> and + <a href="/pkg/go/types/#Named.TypeParams"><code>Named.TypeParams</code></a> to get the + type arguments or type parameters of an instantiated or parameterized type, and + <a href="/pkg/go/types/#Named.TypeParams"><code>Named.SetTypeParams</code></a> to set the + type parameters (for instance, when importing a named type where allocation of the named + type and setting of type parameters cannot be done both at once due to possible cycles). + </li> + <li> + The <a href="/pkg/go/types/#Interface"><code>Interface</code></a> type has four new methods: + <a href="/pkg/go/types/#Interface.IsComparable"><code>Interface.IsComparable</code></a> and + <a href="/pkg/go/types/#Interface.IsMethodSet"><code>Interface.IsMethodSet</code></a> to + query properties of the type set defined by the interface, and + <a href="/pkg/go/types/#Interface.MarkImplicit"><code>Interface.MarkImplicit</code></a> and + <a href="/pkg/go/types/#Interface.IsImplicit"><code>Interface.IsImplicit</code></a> to set + and test whether the interface is an implicit interface around a type constraint literal. + </li> + <li> + The new types + <a href="/pkg/go/types/#Union"><code>Union</code></a> and + <a href="/pkg/go/types/#Term"><code>Term</code></a>, factory functions + <a href="/pkg/go/types/#NewUnion"><code>NewUnion</code></a> and + <a href="/pkg/go/types/#NewTerm"><code>NewTerm</code></a>, and associated + methods were added to represent type sets in interfaces. + </li> + <li> + The new function + <a href="/pkg/go/types/#Instantiate"><code>Instantiate</code></a> + instantiates a parameterized type. + </li> + <li> + The new <a href="/pkg/go/types/#Info.Instances"><code>Info.Instances</code></a> + map records function and type instantiations through the new + <a href="/pkg/go/types/#Instance"><code>Instance</code></a> type. + </li> + <li><!-- CL 342671 --> + The new type <a href="/pkg/go/types/#ArgumentError"><code>ArgumentError</code></a> + and associated methods were added to represent an error related to a type argument. + </li> + <li><!-- CL 353089 --> + The new type <a href="/pkg/go/types/#Context"><code>Context</code></a> and factory function + <a href="/pkg/go/types/#NewContext"><code>NewContext</code></a> + were added to facilitate sharing of identical type instances across type-checked packages. + </li> + </ul> + </dd> +</dl> + <dl id="image/draw"><dt><a href="/pkg/image/draw/">image/draw</a></dt> <dd> <p><!-- CL 340049 --> |