[project @ 2000-12-15 17:07:20 by simonmar]
authorsimonmar <unknown>
Fri, 15 Dec 2000 17:07:20 +0000 (17:07 +0000)
committersimonmar <unknown>
Fri, 15 Dec 2000 17:07:20 +0000 (17:07 +0000)
ASSERT that we have the right number of arguments when building a
constructor, to avoid repeats of today's extended debugging session.

ghc/compiler/codeGen/CgCon.lhs

index 9b22fcc..e09c085 100644 (file)
@@ -45,7 +45,8 @@ import ClosureInfo    ( mkConLFInfo, mkLFArgument,
 import CostCentre      ( currentOrSubsumedCCS, dontCareCCS, CostCentreStack,
                          currentCCS )
 import DataCon         ( DataCon, dataConName, dataConTag, 
-                         isUnboxedTupleCon, isNullaryDataCon, dataConId, dataConWrapId
+                         isUnboxedTupleCon, isNullaryDataCon, dataConId, 
+                         dataConWrapId, dataConRepArity
                        )
 import Id              ( Id, idName, idPrimRep )
 import Literal         ( Literal(..) )
@@ -69,6 +70,7 @@ cgTopRhsCon :: Id             -- Name of thing bound to this RHS
            -> FCode (Id, CgIdInfo)
 cgTopRhsCon id con args
   = ASSERT(not (isDllConApp con args)) -- checks for litlit args too
+    ASSERT(length args == dataConRepArity con)
     let
        name          = idName id
        closure_label = mkClosureLabel name
@@ -269,7 +271,8 @@ sure the @amodes@ passed don't conflict with each other.
 cgReturnDataCon :: DataCon -> [CAddrMode] -> Code
 
 cgReturnDataCon con amodes
-  = getEndOfBlockInfo  `thenFC` \ (EndOfBlockInfo args_sp sequel) ->
+  = ASSERT(length amodes == dataConRepArity con)
+    getEndOfBlockInfo  `thenFC` \ (EndOfBlockInfo args_sp sequel) ->
 
     case sequel of