on master help sign in
Use method info to erase stuff in Compiler.hs.
commit4e1d50ec5ac9da66d84917faba4ddde7bfead42d authorMatus Tejiscak <ziman@functor.sk> dateMon 10 Mar 2014, 16:04 (13 years ago) parentcee5985
2 files changed+9−1
src/IRTS/Compiler.hs+8−1 src/Idris/Erasure.hs+1
src/IRTS/Compiler.hs+8−1
@@ -266,6 +266,8 @@ irTerm vs env tm@(App f a) = case unApply tm of
266266 -- otherwise, just apply the name
267267 _ -> applyName n ist args
268268
269+ (V i, args) -> irTerm vs env (P Bound (env !! i) Erased)
270+
269271 (f, args)
270272 -> LApp False
271273 <$> irTerm vs env f
@@ -288,7 +290,12 @@ irTerm vs env tm@(App f a) = case unApply tm of
288290 [] -> 0 -- no definition, probably local name => can't erase anything
289291 def -> error $ "unknown arity: " ++ show (n, def)
290292
291− used = maybe [] (map fst . usedpos) $ lookupCtxtExact n (idris_callgraph ist)
293+ -- name for purposes of usage info lookup
294+ uName
295+ | Just n' <- viMethod =<< M.lookup n vs = n'
296+ | otherwise = n
297+
298+ used = maybe [] (map fst . usedpos) $ lookupCtxtExact uName (idris_callgraph ist)
292299 fst4 (x,_,_,_) = x
293300
294301irTerm vs env (P _ n _) = return $ LV (Glob n)
src/Idris/Erasure.hs+1
@@ -480,5 +480,6 @@ buildDepMap ci ctx mainName = addPostulates $ dfs S.empty M.empty [mainName]
480480 unionMap :: (a -> Deps) -> [a] -> Deps
481481 unionMap f = M.unionsWith (M.unionWith S.union) . map f
482482
483+-- Make a field name out of a data constructor name and field number.
483484mkFieldName :: Name -> Int -> Name
484485mkFieldName ctorName fieldNo = SN (WhereN fieldNo ctorName $ sMN fieldNo "field")