2.10. Type-alias Declaration

Figure 2.16. Concrete Syntax for Type-alias Declaration

[77] <type-alias> ::= "typealias" <type-alias-id> <basic-type> ";"  

Figure 2.16, “Concrete Syntax for Type-alias Declaration” presents the concrete syntax for type-alias declaration. Type-alias is used to introduce an alias name for a type. That is, every use of the new type name will be substituted by the actual type, and used for conveniently introducing compact names for types. A type-alias can be used to introduce an alias for any basic type; cycles cannot be introduced because type-alias declarations are considered in the order of their declarations.

Namespace. The namespace for type-aliases is the global namespace that is shared with constants, enumerations, records, extensions, global variables, threads and functions, virtual tables, and functional expressions.

Examples. 

              
   typealias byte int wrap(0, 255);
   typealias abc Triple.type<A, B, C>;
   typealias abcset Set.type<abc>;
    

Abstract Syntax Tree. 

Figure 2.17. Java AST for Type-alias Declaration

Java AST for Type-alias Declaration
[ .gif, .svg ]

The Java AST class for type-alias declaration is the TypeAliasDefinition class.