Those who have monitored the Pike 7.7 CVS the last week or so, may
have noticed a few new type checking related functions. These are
intended to replace the current style of type checking where a
function type for the current call is created and then compared in
one pass against the declared type. This has led to somewhat cryptic
error messages. eg:
> `+((["":14]), "", 14);
Compiler Error: 1:Bad argument 2 to `+.
Compiler Error: 1:Expected: !function(!(object | mixed) ... : mixed) & function | function(int, int ... : int) | !function(!float ... : mixed) & function(int | float, int | float ... : float) | !function(!string ... : mixed) & function(string | int | float, string | int | float ... : string) | function((0=array), (1=array) ... : 0 | 1) | function((0=mapping), (1=mapping) ... : 0 | 1) | function((0=multiset), (1=multiset) ... : 0 | 1)
Compiler Error: 1:Got : function(mapping(string(0):int(14..14)), string(0), int(14..14) : void | mixed)
The new code is instead based on checking the arguments one at a time,
but this means that the error in the above case is first detected when
the last argument is checked:
Compiler Error: 1:Bad argument 3 to `+, got int(14..14), expected object.
This problem can be reduced by also adding warnings about prior
arguments in case of the above error:
Compiler Warning: 1:Potentially bad argument 2 to `+, got string(0), expected mapping | object.
The question is what text the warning should have.