Wrong deduced type from overloaded []
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=2774
Reported by Martin Nilsson, IDA nilsson@pike.ida.liu.se
This program
class A {
string `[](mixed ... args) {
return "hej\n";
}
}
int main() {
A a=A();
write( a[1..2] ); // line 11
return 0;
}
fails with
bug.pike:11:Bad argument 1 to write.
bug.pike:11:Expected: function(array(string) | string, mixed | void ... :
int)
bug.pike:11:Got : function({ A = object(implements 65603) } : void |
mixed)
Pike: Failed to compile script:
Compilation failed.