There's another rule to add here, and you could generalize (and improve error reporting!) the type rule.

For optional parameters without defaults, only pointer types should be supported now - there's a big distinction between an 'optional' parameter and an (optional) 'defaulted' parameter. Optional parameters without default describe the type 'union(original type, not specified)', where as optional parameters with default describe just the type 'original type'. At the moment only pointer types can express the union (with 'nil' being the 'not specified value). Thus we need a rule that checks that if the parameter is optional with no default value then the type is one of cstring or objc-*. [ We can add support for optional non-pointer types later ].

The rule that has always been missing is an expansion of the 'DefaultWrongType' - it should really check that if the parameter type is a boolean then the value is appropriate (ideally a Boolean ValueRef - see elsewhere), if the type is integer then it's an Integer valueref, if the type is a number then it's a Real/Integer valueref and if the type is a string type then it's String valueref.

Thinking about it, you can't specify default 'data', 'c-data' values at the moment, so there should perhaps be another rule that checks that if you have an optional 'objc-data', or 'c-data' parameter then there is no default value.