From 576c31aa728444d3115c171969c95116cb236cbf Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Mon, 30 Apr 2007 04:03:29 +0000 Subject: [PATCH] Don't attempt to constant-fold empty arrays --- fco2/EvalConstants.hs | 2 ++ fco2/Types.hs | 1 + 2 files changed, 3 insertions(+) diff --git a/fco2/EvalConstants.hs b/fco2/EvalConstants.hs index 426e3ce..0a94b3b 100644 --- a/fco2/EvalConstants.hs +++ b/fco2/EvalConstants.hs @@ -58,6 +58,8 @@ simplifyExpression ps e --{{{ expression evaluator evalLiteral :: A.Expression -> EvalM OccValue +evalLiteral (A.Literal _ _ (A.ArrayLiteral _ [])) + = throwError "empty array" evalLiteral (A.Literal _ _ (A.ArrayLiteral _ aes)) = liftM OccArray (mapM evalLiteralArray aes) evalLiteral l = evalSimpleLiteral l diff --git a/fco2/Types.hs b/fco2/Types.hs index 905cda7..a7d6b83 100644 --- a/fco2/Types.hs +++ b/fco2/Types.hs @@ -316,6 +316,7 @@ data BytesInResult = BIJust Int -- ^ Just that many bytes. | BIOneFree Int Int -- ^ An array type; A bytes, times unknown dimension B. | BIUnknown -- ^ No idea. + deriving (Show, Eq) -- | Return the size in bytes of a data type. bytesInType :: (PSM m, Die m) => A.Type -> m BytesInResult