on master help sign in
Proof search tweak

When checking types of hints, don't consider the recursive call as an overlapping constructor type, or lots of things don't get filled in which should be.

commit5a08c2cdb7632a7490321e32743cc9bae17ed4a1 authorEdwin Brady <ecb10@st-andrews.ac.uk> dateSun 2 Aug 2015, 14:35 (11 years ago) parent96e9b1a
1 file changed+10−14
src/Idris/ProofSearch.hs+10−14
src/Idris/ProofSearch.hs+10−14
@@ -201,11 +201,13 @@ proofSearch rec fromProver ambigok deferonfail maxDepth elab fn nroot psnames hi
201201 Nothing -> []
202202 Just hs -> hs
203203 case lookupCtxtExact n (idris_datatypes ist) of
204− Just t -> tryCons d locs tys
205− (hints ++
206− con_names t ++
207− autohints ++
208− getFn d fn)
204+ Just t -> do
205+ let others = hints ++ con_names t ++ autohints
206+ when (not fromProver) -- in interactive mode,
207+ -- don't just guess (fine for 'auto',
208+ -- since that's part of the point...)
209+ $ checkDisjoint ist [] others
210+ tryCons d locs tys (others ++ getFn d fn)
209211 Nothing -> fail "Not a data type"
210212 _ -> fail "Not a data type"
211213
@@ -221,15 +223,9 @@ proofSearch rec fromProver ambigok deferonfail maxDepth elab fn nroot psnames hi
221223 | otherwise = try' (tryLocal d (x : locs) tys x t)
222224 (tryLocals d locs tys xs) True
223225
224− tryCons d locs tys cs = do when (not fromProver) -- in interactive mode,
225− -- don't just guess (fine for 'auto',
226− -- since that's part of the point...)
227− $ checkDisjoint ist [] cs
228− tryCons' d locs tys cs
229−
230− tryCons' d locs tys [] = fail "Constructors failed"
231− tryCons' d locs tys (c : cs)
232− = try' (tryCon d locs tys c) (tryCons' d locs tys cs) True
226+ tryCons d locs tys [] = fail "Constructors failed"
227+ tryCons d locs tys (c : cs)
228+ = try' (tryCon d locs tys c) (tryCons d locs tys cs) True
233229
234230 tryLocal d locs tys n t
235231 = do let a = getPArity (delab ist (binderTy t))