From 4b7eaaf43f087cdeff7948ba45459eb8067f5247 Mon Sep 17 00:00:00 2001 From: krangelov Date: Wed, 15 Dec 2021 08:23:31 +0100 Subject: [PATCH] make sure that everything is evaluated before conversion --- src/compiler/GF/Compile/GeneratePMCFG.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/compiler/GF/Compile/GeneratePMCFG.hs b/src/compiler/GF/Compile/GeneratePMCFG.hs index 7803d0cd7..174bf0785 100644 --- a/src/compiler/GF/Compile/GeneratePMCFG.hs +++ b/src/compiler/GF/Compile/GeneratePMCFG.hs @@ -143,13 +143,23 @@ flatten (VV _ tnks) (Table _ q) st = do v <- force tnk flatten v q st flatten v (Sort s) (lins,params) | s == cStr = do + deepForce v return (v:lins,params) flatten v ty@(QC q) (lins,params) = do + deepForce v return (lins,(v,ty):params) flatten v ty (lins,params) - | Just n <- isTypeInts ty = return (lins,(v,ty):params) + | Just n <- isTypeInts ty = do deepForce v + return (lins,(v,ty):params) | otherwise = error (showValue v) +deepForce (VR as) = mapM_ (\(lbl,v) -> force v >>= deepForce) as +deepForce (VApp q tnks) = mapM_ (\tnk -> force tnk >>= deepForce) tnks +deepForce (VC vs) = mapM_ deepForce vs +deepForce (VAlts def alts) = do deepForce def + mapM_ (\(v,_) -> deepForce v) alts +deepForce _ = return () + str2lin (VApp q []) | q == (cPredef, cBIND) = return [SymBIND] | q == (cPredef, cNonExist) = return [SymNE]