Allow references to global values without arguments.
[matthijs/master-project/cλash.git] / Flatten.hs
index d38443b0c8609c2885dfed753693d9f2fdbbdfc1..8d2d5b62b50053c96afb4b384b0ebd6ce3b66341 100644 (file)
@@ -170,6 +170,9 @@ flattenExpr binds var@(Var id) =
           addNameHint (Name.getOccString id) sig_id
           addDef (UncondDef (Right $ Literal lit) sig_id)
           return ([], Single sig_id)
+    IdInfo.VanillaGlobal ->
+      -- Treat references to globals as an application with zero elements
+      flattenApplicationExpr binds (CoreUtils.exprType var) id []
     otherwise ->
       error $ "Ids other than local vars and dataconstructors not supported: " ++ (showSDoc $ ppr id)