on master help sign in
Fix unification error that led to some trivial things not checking
commit6f54612cbfab29134c6f3e18f8e5230349ceacf3 authorEdwin Brady <ecb10@st-andrews.ac.uk> dateThu 18 Oct 2012, 12:18 (14 years ago) parent3c641ae
3 files changed+15−11
src/Core/Unify.hs+10−8 src/IRTS/Inliner.hs+3−1 src/Idris/ElabTerm.hs+2−2
src/Core/Unify.hs+10−8
@@ -28,15 +28,15 @@ unify ctxt env topx topy
2828 = -- case runStateT (un' False [] topx topy) (UI 0 [] []) of
2929 -- OK (v, UI _ inj []) -> return (filter notTrivial v, inj, [])
3030 -- _ ->
31− -- trace ("Unifying " ++ show (topx, topy)) $
31+-- trace ("Unifying " ++ show (topx, topy)) $
3232 let topxn = normalise ctxt env topx
33− topyn = normalise ctxt env topy in
33+ topyn = normalise ctxt env topy in
3434-- trace ("Unifying " ++ show (topxn, topyn)) $
35− case runStateT (un' False [] topxn topyn)
36− (UI 0 [] []) of
37− OK (v, UI _ inj fails) -> return (filter notTrivial v, inj, reverse fails)
35+ case runStateT (un' False [] topxn topyn)
36+ (UI 0 [] []) of
37+ OK (v, UI _ inj fails) -> return (filter notTrivial v, inj, reverse fails)
3838-- OK (_, UI s _ ((_,_,f):fs)) -> tfail $ CantUnify topx topy f s
39− Error e -> tfail e
39+ Error e -> tfail e
4040 where
4141 notTrivial (x, P _ x' _) = x /= x'
4242 notTrivial _ = True
@@ -174,9 +174,11 @@ unify ctxt env topx topy
174174 combine bnames as ((n, t) : bs)
175175 = case lookup n as of
176176 Nothing -> combine bnames (as ++ [(n,t)]) bs
177− Just t' -> do un' False bnames t t'
177+ Just t' -> do ns <- un' False bnames t t'
178+ -- make sure there's n mapping from n in ns
179+ let ns' = filter (\ (x, _) -> x/=n) ns
178180 sc 1
179− combine bnames as bs
181+ combine bnames as (ns' ++ bs)
180182
181183 -- If there are any clashes of constructors, deem it unrecoverable, otherwise some
182184 -- more work may help.
src/IRTS/Inliner.hs+3−1
@@ -16,5 +16,7 @@ inl ds d@(n, DFun n' args exp)
1616 _ -> d
1717inl ds d = d
1818
19−evalD _ e = Just e
19+evalD _ e = ev e
20+ where
21+ ev e = Just e
2022
src/Idris/ElabTerm.hs+2−2
@@ -240,8 +240,8 @@ elab ist info pattern tcgen fn tm
240240 (do apply_elab f (map (toElab (ina || not isinf, guarded)) args)
241241 mkSpecialised ist fc f (map getTm args') tm
242242 solve)
243− -- ptm <- get_term
244− -- elog (show ptm)
243+-- ptm <- get_term
244+-- elog (show ptm)
245245 ivs' <- get_instances
246246 when (not pattern || (ina && not tcgen)) $
247247 mapM_ (\n -> do focus n