Alias declaration

Grammar§

AliasDeclaration ::= Attribute* "alias" Identifier "=" Type ";"

Semantics§

An alias can be declared for a Type or a Declaration.

alias Fun = function(s32 a);
alias FunPtr = Fun*;

struct S { struct R {} }
alias SR = S.R;

The only Attribute allowed on alias is @deprecated.

@deprecated alias LongBool = int;

Using an alias is like using the aliasee, excepted that a deprecation check is performed each time that the alias identifier is used.

alias Int = s32;
var Int i;

function f(s32 p){}

f(i); // call works by exact match