@@ -1007,11 +1007,11 @@ isTCDict n ctxt
10071007 _ -> False
10081008
10091009lookupP :: Name -> Context -> [Term]
1010−lookupP = lookupP_all False
1010+lookupP = lookupP_all False False
10111011
1012−lookupP_all :: Bool -> Name -> Context -> [Term]
1013−lookupP_all all n ctxt
1014− = do (n', def) <- lookupCtxtName n (definitions ctxt)
1012+lookupP_all :: Bool -> Bool -> Name -> Context -> [Term]
1013+lookupP_all all exact n ctxt
1014+ = do (n', def) <- names
10151015 p <- case def of
10161016 (Function ty tm, a, _, _) -> return (P Ref n' ty, a)
10171017 (TyDecl nt ty, a, _, _) -> return (P nt n' ty, a)
@@ -1020,6 +1020,11 @@ lookupP_all all n ctxt
10201020 case snd p of
10211021 Hidden -> if all then return (fst p) else []
10221022 _ -> return (fst p)
1023+ where
1024+ names = let ns = lookupCtxtName n (definitions ctxt) in
1025+ if exact
1026+ then filter (\ (n', d) -> n' == n) ns
1027+ else ns
10231028
10241029lookupDefExact :: Name -> Context -> Maybe Def
10251030lookupDefExact n ctxt = tfst <$> lookupCtxtExact n (definitions ctxt)