Overzealous compile time type check
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=4897
Reported by Martin Stjernholm mast@roxen.com
Consider the following program:
constant c = (["x": (["y": ({1,2,3})])]);
int main()
{
werror ("%O\n", c["x"] && equal (c["x"]["y"], ({1,2,3})));
}
It works and writes out "1". Now, if the constant mapping c is replaced with an empty one, it doesn't even compile:
foo.pike:4:Indexing on illegal type.
foo.pike:4:Got : string(0..255).
The compiler could perhaps optimize the werror expression to 0, but it should compile it even if the mapping happens to be empty. Probably another problem due to an overspecified implied type for constants.