From: simonmar Date: Thu, 22 May 2003 10:53:53 +0000 (+0000) Subject: [project @ 2003-05-22 10:53:53 by simonmar] X-Git-Tag: Approx_11550_changesets_converted~874 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=d0b1c1cdd224e951187eab54757fad0758d1d15a;p=ghc-hetmet.git [project @ 2003-05-22 10:53:53 by simonmar] Fix obscure bug in GHCi: when generating code for tag2enum#, we were wrongly using the source name for the DataCons rather than the worker name, which lead to spurious link errors. This fixes galois_raytrace(ghci). --- diff --git a/ghc/compiler/ghci/ByteCodeGen.lhs b/ghc/compiler/ghci/ByteCodeGen.lhs index 3a704a7..b5ce3fc 100644 --- a/ghc/compiler/ghci/ByteCodeGen.lhs +++ b/ghc/compiler/ghci/ByteCodeGen.lhs @@ -510,11 +510,14 @@ schemeT d s p app -- Detect and extract relevant info for the tagToEnum kludge. maybe_is_tagToEnum_call = let extract_constr_Names ty - = case splitTyConApp_maybe (repType ty) of - (Just (tyc, [])) | isDataTyCon tyc - -> map getName (tyConDataCons tyc) - other -> panic "maybe_is_tagToEnum_call.extract_constr_Ids" - in + | Just (tyc, []) <- splitTyConApp_maybe (repType ty), + isDataTyCon tyc + = map (getName . dataConWorkId) (tyConDataCons tyc) + -- NOTE: use the worker name, not the source name of + -- the DataCon. See DataCon.lhs for details. + | otherwise + = panic "maybe_is_tagToEnum_call.extract_constr_Ids" + in case app of (AnnApp (_, AnnApp (_, AnnVar v) (_, AnnType t)) arg) -> case isPrimOpId_maybe v of