Fixed the type of a list for the empty list

This commit is contained in:
Neil Brown 2008-03-20 16:44:36 +00:00
parent 0e3465afc0
commit d4991461a5

View File

@ -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