From d4991461a514bd3263b053496903d7e0d926e3d6 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 20 Mar 2008 16:44:36 +0000 Subject: [PATCH] Fixed the type of a list for the empty list --- frontends/RainTypes.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontends/RainTypes.hs b/frontends/RainTypes.hs index 1e1a726..f6c18ef 100644 --- a/frontends/RainTypes.hs +++ b/frontends/RainTypes.hs @@ -94,9 +94,10 @@ annotateListLiteralTypes = everywhereASTM doExpression doExpression :: A.Expression -> PassM A.Expression doExpression (A.Literal m _ (A.ListLiteral m' es)) = do ts <- mapM typeOfExpression es - sharedT <- case leastGeneralSharedTypeRain ts of - Just t -> return t - Nothing -> diePC m' + sharedT <- case (ts, leastGeneralSharedTypeRain ts) of + (_, Just t) -> return t + ([], Nothing) -> return A.Any + (_, Nothing) -> diePC m' $ formatCode "Can't determine a common type for the list literal from: %" ts