Description
This issue was originally filed by [email protected]
typedef use formalParameterList for declare an alias of function type.
But this rule surprise many users.
For example.
int f( int x ) => x ;
typedef int type( int ) ;
void main()
{
type t = f ;
t("a") ; // no static type warning is issued.
}
This is because int is treated as an identifier in simpleFormalParameter.
So int is just a name of parameter and its type is Dynamic.
But most user who don't read spec expect above typedef to annotate that the static type of parameter is int.
That's why they surprise the above code doesn't issue a static type warning.
To solve this issue, I propose to make finalVarOrType in mandatory for the typedef.
Under the proposed change, above typedef must be rewritten as
typedef int f( var int ) ;
This makes it apparent for all users that int is just a name of parameter and its type is Dynamic since it use var.