-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
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
After a bit of hacking I managed to reduce it to the following program: (which uses Isabelle's pretty printing library, and which I tested using Isabelle2007)
fun foo l s x i = [] @ map (fn (i,s) => Pretty.block [(case x of NONE => Pretty.str "a" | SOME openi => (if (openi = i) then Pretty.str "b" else Pretty.str "c")), Pretty.str "d"]) l;
This is running PolyML 5.1... is this a known issue fixed in more recent cvs snapshots?
My workaround was to move the case statement into it's own function. Then it compiles ok.
cheers, lucas
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