on master help sign in
Fix error in case tree optimisation (hence fix issue #70)
commit7af45b4ef1ee5efb9798549e1da2e46ebabba5bb authorEdwin Brady <ecb10@st-andrews.ac.uk> dateWed 21 Nov 2012, 18:21 (14 years ago) parent2856967
1 file changed+3−2
src/Core/CaseTree.hs+3−2
src/Core/CaseTree.hs+3−2
@@ -356,7 +356,7 @@ varRule (v : vs) alts err =
356356 repVar v (PV p : ps , (lhs, res)) = (ps, (lhs, subst p (P Bound v Erased) res))
357357 repVar v (PAny : ps , res) = (ps, res)
358358
359−-- fix: case e of S k -> f (S k) ==> case e of S k -. f e
359+-- fix: case e of S k -> f (S k) ==> case e of S k -> f e
360360depatt :: [Name] -> SC -> SC
361361depatt ns tm = dp [] tm
362362 where
@@ -376,7 +376,8 @@ depatt ns tm = dp [] tm
376376 where
377377 applyMap [] nt cn pty args' = mkApp (P nt cn pty) args'
378378 applyMap ((x, (n, args)) : ms) nt cn pty args'
379− | and ((n == cn) : zipWith same args args') = P Ref x Erased
379+ | and ((length args == length args') :
380+ (n == cn) : zipWith same args args') = P Ref x Erased
380381 | otherwise = applyMap ms nt cn pty args'
381382 same n (P _ n' _) = n == n'
382383 same _ _ = False