From: Robert Griesemer Alias 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 Alias.
+ 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, Alias types will also carry type parameter information.
The new function Unalias returns the actual type denoted by an
Alias type (or any other Type for that matter).
+
Because Alias types may break existing type switches that do not know to check for them,
this functionality is controlled by a GODEBUG field named gotypesalias.
With gotypesalias=0, everything behaves as before, and Alias types are never created.
With gotypesalias=1, Alias types are created and clients must expect them.
The default is gotypesalias=0.
In a future release, the default will be changed to gotypesalias=1.
+ Clients of go/types are urged to adjust their code as soon as possible
+ to work with gotypesalias=1 to eliminate problems early.