@@ -513,8 +513,22 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
513
513
for the given import declaration.
514
514
</ p >
515
515
516
- < p > <!-- https://go.dev/issue/63223 -->
517
- TODO: < a href ="https://go.dev/issue/63223 "> https://go.dev/issue/63223</ a > : API changes to support explicit Alias nodes
516
+ < p > <!-- https://go.dev/issue/63223, CL 521956, CL 541737 -->
517
+ The new < a href ="/pkg/go/types#Alias "> < code > Alias</ code > </ a > type represents type aliases.
518
+ Previously, type aliases were not represented explicitly, so a reference to a type alias was equivalent
519
+ to spelling out the aliased type, and the name of the alias was lost.
520
+ The new representation retains the intermediate Alias.
521
+ This enables improved error reporting (the name of an alias can be reported), and allows for better handling
522
+ of cyclic type declarations involving type aliases.
523
+ In a future release, < code > Alias</ code > types will also carry < a href ="https://go.dev/issue/46477 "> type parameter information</ a > .
524
+ The new function < a href ="/pkg/go/types#Unalias "> < code > Unalias</ code > </ a > returns the actual type denoted by an
525
+ < code > Alias</ code > type (or any other < a href ="/pkg/go/types#Type "> < code > Type</ code > </ a > for that matter).
526
+ Because < code > Alias</ code > types may break existing type switches that do not know to check for them,
527
+ this functionality is controlled by a < a href ="/doc/godebug "> < code > GODEBUG</ code > </ a > field named < code > gotypesalias</ code > .
528
+ With < code > gotypesalias=0</ code > , everything behaves as before, and < code > Alias</ code > types are never created.
529
+ With < code > gotypesalias=1</ code > , < code > Alias</ code > types are created and clients must expect them.
530
+ The default is < code > gotypesalias=0</ code > .
531
+ In a future release, the default will be changed to < code > gotypesalias=1</ code > .
518
532
</ p >
519
533
520
534
< p > <!-- https://go.dev/issue/61035, multiple CLs, see issue for details -->
@@ -524,13 +538,9 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
524
538
< code > types.SizesFor("gc", "amd64")</ code > .
525
539
</ p >
526
540
527
- < p > <!-- CL 541737 -->
528
- TODO: < a href ="https://go.dev/cl/541737 "> https://go.dev/cl/541737</ a > : go/types, types2: implement Alias proposal (export API); modified api/next/63223.txt
529
- </ p >
530
-
531
541
< p > <!-- https://go.dev/issue/64295, CL 544035 -->
532
- The start position (< a href ="/pkg/go/types#Scope.Pos "> Pos</ a > )
533
- of the lexical environment block (< a href ="/pkg/go/types#Scope "> Scope</ a > )
542
+ The start position (< a href ="/pkg/go/types#Scope.Pos "> < code > Pos</ code > </ a > )
543
+ of the lexical environment block (< a href ="/pkg/go/types#Scope "> < code > Scope</ code > </ a > )
534
544
that represents a function body has changed:
535
545
it used to start at the opening curly brace of the function body,
536
546
but now starts at the function's < code > func</ code > token.
0 commit comments