From 86bbdc8b8e2d8b93a96521d7c9787556a6f0f7d9 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 26 Mar 2009 18:38:53 +0000 Subject: [PATCH] Changed the constant folder to fold RetypesExpr --- frontends/OccamPasses.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontends/OccamPasses.hs b/frontends/OccamPasses.hs index 4999052..4e5eef6 100644 --- a/frontends/OccamPasses.hs +++ b/frontends/OccamPasses.hs @@ -122,6 +122,14 @@ foldConstants = occamOnlyPass "Fold constants" -- (Even if it isn't an expression itself, it might have others inside it, -- so we just update them all.) doSpecification :: A.Specification -> PassM A.Specification + doSpecification spec@(A.Specification m n (A.RetypesExpr _ _ t _)) + = do e <- getConstantName n + case e of + Just e' -> + let newSpec = A.Is m A.ValAbbrev t (A.ActualExpression e') in + do modifyName n $ \nd -> nd { A.ndSpecType = newSpec } + return $ A.Specification m n newSpec + Nothing -> return spec doSpecification s@(A.Specification _ n st) = do modifyName n (\nd -> nd { A.ndSpecType = st }) return s