@@ -87,7 +87,7 @@ elabType' norm info syn doc argDocs fc opts n ty' = {- let ty' = piBind (params
8787 let ty = addImpl i ty'
8888 inacc = inaccessible 0 ty
8989 logLvl 3 $ show n ++ " type " ++ showTmImpls ty
90− logLvl 5 $ "Erased params: " ++ show inacc
90+ logLvl 5 $ "Inaccessible arguments: " ++ show inacc
9191
9292 ((tyT, defer, is), log) <-
9393 tclift $ elaborate ctxt n (TType (UVal 0)) []
@@ -133,8 +133,10 @@ elabType' norm info syn doc argDocs fc opts n ty' = {- let ty' = piBind (params
133133 addDocStr n doc argDocs
134134 addIBC (IBCDoc n)
135135 addIBC (IBCFlags n opts')
136+ saveInaccArgs n inacc
136137 when (Implicit `elem` opts') $ do addCoercion n
137138 addIBC (IBCCoercion n)
139+
138140 -- If the function is declared as an error handler and the language
139141 -- extension is enabled, then add it to the list of error handlers.
140142 errorReflection <- fmap (elem ErrorReflection . idris_language_extensions) getIState
@@ -164,6 +166,19 @@ elabType' norm info syn doc argDocs fc opts n ty' = {- let ty' = piBind (params
164166 lst = txt "List"
165167 errrep = txt "ErrorReportPart"
166168
169+ saveInaccArgs :: Name -> [Int] -> Idris ()
170+ saveInaccArgs n is = do
171+ ist <- getIState
172+ case lookupCtxt n (idris_optimisation ist) of
173+ [oi] -> do
174+ putIState ist{ idris_optimisation =
175+ addDef n oi{ inaccessible = is } (idris_optimisation ist) }
176+
177+ _ -> do
178+ putIState ist{ idris_optimisation =
179+ addDef n (Optimise False False [] [] is) (idris_optimisation ist) }
180+ addIBC (IBCOpt n)
181+
167182 inaccessible :: Int -> PTerm -> [Int]
168183 inaccessible i (PPi (Imp _ _ _ _) n Placeholder t)
169184 = i : inaccessible (i+1) t -- unbound implicit
@@ -965,7 +980,7 @@ elabClauses info fc opts n_in cs = let n = liftname info n_in in
965980 [oi] -> do let opts = addDef n (oi { collapsible = True })
966981 (idris_optimisation ist)
967982 putIState (ist { idris_optimisation = opts })
968− _ -> do let opts = addDef n (Optimise True False [] [])
983+ _ -> do let opts = addDef n (Optimise True False [] [] [])
969984 (idris_optimisation ist)
970985 putIState (ist { idris_optimisation = opts })
971986 addIBC (IBCOpt n)