[project @ 2003-03-20 12:20:06 by simonpj]
authorsimonpj <unknown>
Thu, 20 Mar 2003 12:20:06 +0000 (12:20 +0000)
committersimonpj <unknown>
Thu, 20 Mar 2003 12:20:06 +0000 (12:20 +0000)
----------------------------------
      Fix a long-standing egregious CorePrep bug
----------------------------------

**** Merge to Stable branch ****

CorePrep was eta-reducing

\x -> (# a,x #)
to
(#,#) a

which is utterly wrong.  Easily fixed though.

ghc/compiler/basicTypes/Id.lhs

index 42aa3d1..949ed23 100644 (file)
@@ -96,6 +96,7 @@ import Type           ( Type, typePrimRep, addFreeTyVars,
 import IdInfo 
 
 import qualified Demand        ( Demand )
+import DataCon         ( isUnboxedTupleCon )
 import NewDemand       ( Demand, StrictSig, topDmd, topSig, isBottomingSig )
 import Name            ( Name, OccName,
                          mkSystemName, mkSystemNameEncoded, mkInternalName,
@@ -276,11 +277,13 @@ isDataConWrapId id = case globalIdDetails id of
 -- binding, even though it is defined in this module.  
 -- Data constructor workers used to be things of this kind, but
 -- they aren't any more.  Instead, we inject a binding for 
--- them at the CorePrep stage.
+-- them at the CorePrep stage. 
+-- EXCEPT: unboxed tuples, which definitely have no binding
 hasNoBinding id = case globalIdDetails id of
-                       PrimOpId _  -> True
-                       FCallId _   -> True
-                       other       -> False
+                       PrimOpId _       -> True
+                       FCallId _        -> True
+                       DataConWorkId dc -> isUnboxedTupleCon dc
+                       other            -> False
 
 isImplicitId :: Id -> Bool
        -- isImplicitId tells whether an Id's info is implied by other