From 368cd7ffbe5a9addee1c5cd26d4df1e7fa125c38 Mon Sep 17 00:00:00 2001 From: hallgren Date: Thu, 20 Dec 2012 16:41:43 +0000 Subject: [PATCH] bug fix in the new partial evaluator It can leave wildcard tables in their origial form, but it easy to handle them in the unfactor function in GeneratePMCFG. --- src/compiler/GF/Compile/GeneratePMCFG.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/compiler/GF/Compile/GeneratePMCFG.hs b/src/compiler/GF/Compile/GeneratePMCFG.hs index f733f5a0a..dca1f74fd 100644 --- a/src/compiler/GF/Compile/GeneratePMCFG.hs +++ b/src/compiler/GF/Compile/GeneratePMCFG.hs @@ -148,10 +148,18 @@ unfactor t = CM (\gr c -> c (unfac gr t)) where unfac gr t = case t of - T (TTyped ty) [(PV x,u)] -> V ty [restore x v (unfac gr u) | v <- err bug id (allParamValues gr ty)] - T (TTyped ty) _ -> ppbug $ text "unfactor"<+>ppTerm Unqualified 10 t + T (TTyped ty) [(PV x,u)] -> let u' = unfac gr u + in V ty [restore x v u' | v <- allparams ty] + T (TTyped ty) [(PW ,u)] -> let u' = unfac gr u + in V ty [u' | _ <- allparams ty] + T (TTyped ty) _ -> -- converTerm doesn't handle these tables + ppbug $ + sep [text "unfactor"<+>ppTerm Unqualified 10 t, + text (show t)] _ -> composSafeOp (unfac gr) t where + allparams ty = err bug id (allParamValues gr ty) + restore x u t = case t of Vr y | y == x -> u _ -> composSafeOp (restore x u) t