A case of confusing error reporting
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=1595
Reported by Martin Stjernholm mast@roxen.com
As a follow-up to [bug #1593 (closed)], consider the following program:
int main()
{
min = (mixed) 17;
if (min < 4711) return 1;
}
The problem is that the variable "min" lacks a definition so that Pike resolves it to the efun "min" instead. It's currently reported like this:
/home/mast/foo.pike:4:Bad argument 2 to `<.
/home/mast/foo.pike:4:Expected: function(program(object) | type(mixed),
program(object) | type(mixed), program(object) | type(mixed) ... :
int(0..1)) | function(string ... : int(0..1)) | function(float | int ... :
int(0..1)) | !function(!(mixed | object) ... : mixed) & function(mixed ...
: int(0..1))
/home/mast/foo.pike:4:Got : function(function(string ... : string) |
function((0=int | float) ... : 0) | !function(string ... : mixed) &
!function(int | float ... : mixed) & !function(!(object | mixed) ... :
mixed) & function(mixed ... : mixed), int(4711..4711) : void | mixed)
Pike: Failed to compile script:
Compilation failed.
What threw me off the track is that the earlier assignment seemed to work, since Pike didn't report an error on that line. It's first in a later pass that Pike discovers that "min" isn't an lvalue. It'd be nice if the lvalue check was done earlier to avoid this confusing situation.