@@ -124,29 +124,29 @@ mkIBC (i:is) f = do ist <- getIState
125ibc :: IState -> IBCWrite -> IBCFile -> Idris IBCFile
125ibc :: IState -> IBCWrite -> IBCFile -> Idris IBCFile
126ibc i (IBCFix d) f = return f { ibc_fixes = d : ibc_fixes f }
126ibc i (IBCFix d) f = return f { ibc_fixes = d : ibc_fixes f }
127−ibc i (IBCImp n) f = case lookupCtxt n (idris_implicits i) of
127+ibc i (IBCImp n) f = case lookupCtxtExact n (idris_implicits i) of
128− [v] -> return f { ibc_implicits = (n,v): ibc_implicits f }
128+ Just v -> return f { ibc_implicits = (n,v): ibc_implicits f }
129 _ -> ifail "IBC write failed"
129 _ -> ifail "IBC write failed"
130ibc i (IBCStatic n) f
130ibc i (IBCStatic n) f
131− = case lookupCtxt n (idris_statics i) of
131+ = case lookupCtxtExact n (idris_statics i) of
132− [v] -> return f { ibc_statics = (n,v): ibc_statics f }
132+ Just v -> return f { ibc_statics = (n,v): ibc_statics f }
133 _ -> ifail "IBC write failed"
133 _ -> ifail "IBC write failed"
134ibc i (IBCClass n) f
134ibc i (IBCClass n) f
135− = case lookupCtxt n (idris_classes i) of
135+ = case lookupCtxtExact n (idris_classes i) of
136− [v] -> return f { ibc_classes = (n,v): ibc_classes f }
136+ Just v -> return f { ibc_classes = (n,v): ibc_classes f }
137 _ -> ifail "IBC write failed"
137 _ -> ifail "IBC write failed"
138ibc i (IBCInstance int n ins) f
138ibc i (IBCInstance int n ins) f
139 = return f { ibc_instances = (int,n,ins): ibc_instances f }
139 = return f { ibc_instances = (int,n,ins): ibc_instances f }
140ibc i (IBCDSL n) f
140ibc i (IBCDSL n) f
141− = case lookupCtxt n (idris_dsls i) of
141+ = case lookupCtxtExact n (idris_dsls i) of
142− [v] -> return f { ibc_dsls = (n,v): ibc_dsls f }
142+ Just v -> return f { ibc_dsls = (n,v): ibc_dsls f }
143 _ -> ifail "IBC write failed"
143 _ -> ifail "IBC write failed"
144ibc i (IBCData n) f
144ibc i (IBCData n) f
145− = case lookupCtxt n (idris_datatypes i) of
145+ = case lookupCtxtExact n (idris_datatypes i) of
146− [v] -> return f { ibc_datatypes = (n,v): ibc_datatypes f }
146+ Just v -> return f { ibc_datatypes = (n,v): ibc_datatypes f }
147 _ -> ifail "IBC write failed"
147 _ -> ifail "IBC write failed"
148−ibc i (IBCOpt n) f = case lookupCtxt n (idris_optimisation i) of
148+ibc i (IBCOpt n) f = case lookupCtxtExact n (idris_optimisation i) of
149− [v] -> return f { ibc_optimise = (n,v): ibc_optimise f }
149+ Just v -> return f { ibc_optimise = (n,v): ibc_optimise f }
150 _ -> ifail "IBC write failed"
150 _ -> ifail "IBC write failed"
151ibc i (IBCSyntax n) f = return f { ibc_syntax = n : ibc_syntax f }
151ibc i (IBCSyntax n) f = return f { ibc_syntax = n : ibc_syntax f }
152ibc i (IBCKeyword n) f = return f { ibc_keywords = n : ibc_keywords f }
152ibc i (IBCKeyword n) f = return f { ibc_keywords = n : ibc_keywords f }
@@ -158,12 +158,12 @@ ibc i (IBCCGFlag tgt n) f = return f { ibc_cgflags = (tgt, n) : ibc_cgflags f }
158ibc i (IBCDyLib n) f = return f {ibc_dynamic_libs = n : ibc_dynamic_libs f }
158ibc i (IBCDyLib n) f = return f {ibc_dynamic_libs = n : ibc_dynamic_libs f }
159ibc i (IBCHeader tgt n) f = return f { ibc_hdrs = (tgt, n) : ibc_hdrs f }
159ibc i (IBCHeader tgt n) f = return f { ibc_hdrs = (tgt, n) : ibc_hdrs f }
160ibc i (IBCDef n) f
160ibc i (IBCDef n) f
161− = do f' <- case lookupDef n (tt_ctxt i) of
161+ = do f' <- case lookupDefExact n (tt_ctxt i) of
162− [v] -> do (v', (f', _)) <- runStateT (updateDef v) (f, length (symbols f))
162+ Just v -> do (v', (f', _)) <- runStateT (updateDef v) (f, length (symbols f))
163− return f' { ibc_defs = (n,v) : ibc_defs f' }
163+ return f' { ibc_defs = (n,v) : ibc_defs f' }
164 _ -> ifail "IBC write failed"
164 _ -> ifail "IBC write failed"
165− case lookupCtxt n (idris_patdefs i) of
165+ case lookupCtxtExact n (idris_patdefs i) of
166− [v] -> return f' { ibc_patdefs = (n,v) : ibc_patdefs f' }
166+ Just v -> return f' { ibc_patdefs = (n,v) : ibc_patdefs f' }
167 _ -> return f' -- Not a pattern definition
167 _ -> return f' -- Not a pattern definition
169 updateDef :: Def -> StateT (IBCFile, Int) Idris Def
169 updateDef :: Def -> StateT (IBCFile, Int) Idris Def
@@ -220,11 +220,11 @@ ibc i (IBCDef n) f
220 update t = return t
220 update t = return t
223−ibc i (IBCDoc n) f = case lookupCtxt n (idris_docstrings i) of
223+ibc i (IBCDoc n) f = case lookupCtxtExact n (idris_docstrings i) of
224− [v] -> return f { ibc_docstrings = (n,v) : ibc_docstrings f }
224+ Just v -> return f { ibc_docstrings = (n,v) : ibc_docstrings f }
225 _ -> ifail "IBC write failed"
225 _ -> ifail "IBC write failed"
226−ibc i (IBCCG n) f = case lookupCtxt n (idris_callgraph i) of
226+ibc i (IBCCG n) f = case lookupCtxtExact n (idris_callgraph i) of
227− [v] -> return f { ibc_cg = (n,v) : ibc_cg f }
227+ Just v -> return f { ibc_cg = (n,v) : ibc_cg f }
228 _ -> ifail "IBC write failed"
228 _ -> ifail "IBC write failed"
229ibc i (IBCCoercion n) f = return f { ibc_coercions = n : ibc_coercions f }
229ibc i (IBCCoercion n) f = return f { ibc_coercions = n : ibc_coercions f }
230ibc i (IBCAccess n a) f = return f { ibc_access = (n,a) : ibc_access f }
230ibc i (IBCAccess n a) f = return f { ibc_access = (n,a) : ibc_access f }
@@ -336,8 +336,8 @@ pImports fs
336pImps :: [(Name, [PArg])] -> Idris ()
336pImps :: [(Name, [PArg])] -> Idris ()
337pImps imps = mapM_ (\ (n, imp) ->
337pImps imps = mapM_ (\ (n, imp) ->
338 do i <- getIState
338 do i <- getIState
339− case lookupDefAcc n False (tt_ctxt i) of
339+ case lookupDefAccExact n False (tt_ctxt i) of
340− [(n, Hidden)] -> return ()
340+ Just (n, Hidden) -> return ()
341 _ -> putIState (i { idris_implicits
341 _ -> putIState (i { idris_implicits
342 = addDef n imp (idris_implicits i) }))
342 = addDef n imp (idris_implicits i) }))
@@ -358,8 +358,8 @@ pClasses cs = mapM_ (\ (n, c) ->
358 do i <- getIState
358 do i <- getIState
359 -- Don't lose instances from previous IBCs, which
359 -- Don't lose instances from previous IBCs, which
360 -- could have loaded in any order
360 -- could have loaded in any order
361− let is = case lookupCtxt n (idris_classes i) of
361+ let is = case lookupCtxtExact n (idris_classes i) of
362− [CI _ _ _ _ _ ins] -> ins
362+ Just (CI _ _ _ _ _ ins) -> ins
364 let c' = c { class_instances =
364 let c' = c { class_instances =
365 class_instances c ++ is }
365 class_instances c ++ is }
@@ -433,9 +433,10 @@ pDefs syms ds
433 do let d' = updateDef d
433 do let d' = updateDef d
434 case d' of
434 case d' of
435 TyDecl _ _ -> return ()
435 TyDecl _ _ -> return ()
436+ _ -> do iLOG $ "SOLVING " ++ show n
436− _ -> solveDeferred n
437+ solveDeferred n
437 i <- getIState
438 i <- getIState
438− logLvl 5 $ "Added " ++ show (n, d')
439+-- logLvl 1 $ "Added " ++ show (n, d')
439 putIState (i { tt_ctxt = addCtxtDef n d' (tt_ctxt i) })) ds
440 putIState (i { tt_ctxt = addCtxtDef n d' (tt_ctxt i) })) ds
441 updateDef (CaseOp c t args o s cd)
442 updateDef (CaseOp c t args o s cd)