Lucas Dixon wrote:
While compiling a large program I came across the following rather strange error message:
Exception- Subscript unexpectedly raised while compiling Exception- Fail "Exception- Subscript unexpectedly raised while compiling" raised
My workaround was to move the case statement into it's own function. Then it compiles ok.
Lucas, Thanks for reporting this and cutting it down to a manageable example. I've fixed it in the CVS. It had to do with the optimiser processing code that would not actually be executed at run-time. In your code it was one of the branches of the case inside Pretty but once I understood the problem I managed to provoke it with:
datatype t = A of int*int | B of int*int*int; val B(_,_,x) = A(1,2);
Here there is a test that will cause the Bind exception to be raised so that the code that extracts "x" will never be executed. However, it's still seen by the optimiser and that was what fell over.
David