@@ -266,6 +266,8 @@ irTerm vs env tm@(App f a) = case unApply tm of
266 -- otherwise, just apply the name
266 -- otherwise, just apply the name
267 _ -> applyName n ist args
267 _ -> applyName n ist args
269+ (V i, args) -> irTerm vs env (P Bound (env !! i) Erased)
269 (f, args)
271 (f, args)
270 -> LApp False
272 -> LApp False
271 <$> irTerm vs env f
273 <$> irTerm vs env f
@@ -288,7 +290,12 @@ irTerm vs env tm@(App f a) = case unApply tm of
288 [] -> 0 -- no definition, probably local name => can't erase anything
290 [] -> 0 -- no definition, probably local name => can't erase anything
289 def -> error $ "unknown arity: " ++ show (n, def)
291 def -> error $ "unknown arity: " ++ show (n, def)
293+ -- name for purposes of usage info lookup
295+ | Just n' <- viMethod =<< M.lookup n vs = n'
291− used = maybe [] (map fst . usedpos) $ lookupCtxtExact n (idris_callgraph ist)
298+ used = maybe [] (map fst . usedpos) $ lookupCtxtExact uName (idris_callgraph ist)
292 fst4 (x,_,_,_) = x
299 fst4 (x,_,_,_) = x
294irTerm vs env (P _ n _) = return $ LV (Glob n)
301irTerm vs env (P _ n _) = return $ LV (Glob n)