X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fiface%2FBuildTyCl.lhs;h=de1c1915a67e37c4fd9ff0845ffc5c11dfc30393;hb=81e41fe31fb27b6330762d93ce90eb98899beb24;hp=9213afd4ce3a699b61c871bb4bba1dbeb8a2152e;hpb=9ffadf219cbc4f8ec57264786df936a3cee88aec;p=ghc-hetmet.git diff --git a/compiler/iface/BuildTyCl.lhs b/compiler/iface/BuildTyCl.lhs index 9213afd..de1c191 100644 --- a/compiler/iface/BuildTyCl.lhs +++ b/compiler/iface/BuildTyCl.lhs @@ -20,7 +20,6 @@ import Var import VarSet import BasicTypes import Name -import OccName import MkId import Class import TyCon @@ -30,8 +29,6 @@ import Coercion import TcRnMonad import Util ( count ) import Outputable - -import Data.List \end{code} @@ -121,7 +118,18 @@ mkOpenDataTyConRhs = OpenTyCon Nothing mkDataTyConRhs :: [DataCon] -> AlgTyConRhs mkDataTyConRhs cons - = DataTyCon { data_cons = cons, is_enum = all isNullarySrcDataCon cons } + = DataTyCon { + data_cons = cons, + is_enum = -- We define datatypes with no constructors to not be + -- enumerations; this fixes trac #2578, Otherwise we + -- end up generating an empty table for + -- __closure_tbl + -- which is used by tagToEnum# to map Int# to constructors + -- in an enumeration. The empty table apparently upset + -- the linker. + not (null cons) && + all isNullarySrcDataCon cons + } mkNewTyConRhs :: Name -> TyCon -> DataCon -> TcRnIf m n AlgTyConRhs -- Monadic because it makes a Name for the coercion TyCon