mirror of
https://github.com/golang/go
synced 2024-11-26 03:37:57 -07:00
doc: emphasize gotypesalias GODEBUG flag in go 1.22 release notes
Per discussion with rfindley. Change-Id: Ia1cff05aff724eb8c919ffcc1fac121ca017efe9 Reviewed-on: https://go-review.googlesource.com/c/go/+/549056 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
018c1da0cf
commit
7baaa20e38
@ -503,18 +503,22 @@ defer func() {
|
||||
The new <a href="/pkg/go/types#Alias"><code>Alias</code></a> type represents type aliases.
|
||||
Previously, type aliases were not represented explicitly, so a reference to a type alias was equivalent
|
||||
to spelling out the aliased type, and the name of the alias was lost.
|
||||
The new representation retains the intermediate Alias.
|
||||
This enables improved error reporting (the name of an alias can be reported), and allows for better handling
|
||||
The new representation retains the intermediate <code>Alias</code>.
|
||||
This enables improved error reporting (the name of a type alias can be reported), and allows for better handling
|
||||
of cyclic type declarations involving type aliases.
|
||||
In a future release, <code>Alias</code> types will also carry <a href="https://go.dev/issue/46477">type parameter information</a>.
|
||||
The new function <a href="/pkg/go/types#Unalias"><code>Unalias</code></a> returns the actual type denoted by an
|
||||
<code>Alias</code> type (or any other <a href="/pkg/go/types#Type"><code>Type</code></a> for that matter).
|
||||
</p>
|
||||
<p>
|
||||
Because <code>Alias</code> types may break existing type switches that do not know to check for them,
|
||||
this functionality is controlled by a <a href="/doc/godebug"><code>GODEBUG</code></a> field named <code>gotypesalias</code>.
|
||||
With <code>gotypesalias=0</code>, everything behaves as before, and <code>Alias</code> types are never created.
|
||||
With <code>gotypesalias=1</code>, <code>Alias</code> types are created and clients must expect them.
|
||||
The default is <code>gotypesalias=0</code>.
|
||||
In a future release, the default will be changed to <code>gotypesalias=1</code>.
|
||||
<em>Clients of <a href="/pkg/go/types"><code>go/types</code></a> are urged to adjust their code as soon as possible
|
||||
to work with <code>gotypesalias=1</code> to eliminate problems early.</em>
|
||||
</p>
|
||||
|
||||
<p><!-- https://go.dev/issue/62605, CL 540056 -->
|
||||
|
Loading…
Reference in New Issue
Block a user