on master help sign in
Compile data ctors with real arity.
080a291Matus Tejiscak
src/IRTS/Compiler.hs+8−10
@@ -151,16 +151,14 @@ mkLDecl n (CaseOp ci _ _ _ pats cd)
151 do e <- ir (args, sc)
151 do e <- ir (args, sc)
152 return (declArgs [] (case_inlinable ci) n e)
152 return (declArgs [] (case_inlinable ci) n e)
153
153
154−mkLDecl n (TyDecl (DCon t a) _) = do
154+mkLDecl n (TyDecl (DCon tag arity) _) = do
155− cg <- idris_callgraph <$> getIState
155+ ist <- getIState
156− return $ LConstructor n t a
156+
157−{-
158− case lookupCtxt n cg of
157+ let realArity = case lookupCtxt n (idris_callgraph ist) of
159− [CGInfo _ _ _ _ [(i, _)]]
158+ [CGInfo _ _ _ _ xs] -> length xs
160− | -> iLOG $ "USED: " ++ show n ++ ": " ++ show used
159+ _ -> arity
161− [CGInfo _ _ _ _ used] -> iLOG $ "USED: " ++ show n ++ ": " ++ show used
160+
162− _ -> return $ LConstructor n t a
161+ return $ LConstructor n tag realArity
163−-}
164
162
165mkLDecl n (TyDecl (TCon t a) _) = return $ LConstructor n (-1) a
163mkLDecl n (TyDecl (TCon t a) _) = return $ LConstructor n (-1) a
166mkLDecl n _ = return $ (declArgs [] True n LNothing) -- postulate, never run
164mkLDecl n _ = return $ (declArgs [] True n LNothing) -- postulate, never run