[commit: ghc] master: Shortcut a test in exprIsOk (d357f52)
git at git.haskell.org
git at git.haskell.org
Tue Mar 14 20:45:38 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/d357f526582e3c4cd4fbda5d73695fc81121b69a/ghc
>---------------------------------------------------------------
commit d357f526582e3c4cd4fbda5d73695fc81121b69a
Author: David Feuer <david.feuer at gmail.com>
Date: Tue Mar 14 16:43:37 2017 -0400
Shortcut a test in exprIsOk
`exprIsOk` didn't shortcut properly when checking `case` (it used
`foldl` inappropriately). Fix that.
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3343
>---------------------------------------------------------------
d357f526582e3c4cd4fbda5d73695fc81121b69a
compiler/coreSyn/CoreUtils.hs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs
index dce7ef9..3dfb52f 100644
--- a/compiler/coreSyn/CoreUtils.hs
+++ b/compiler/coreSyn/CoreUtils.hs
@@ -1130,8 +1130,8 @@ exprIsOk ok_app e
go _ (Type {}) = True
go _ (Coercion {}) = True
go n (Cast e _) = go n e
- go n (Case scrut _ _ alts) = foldl (&&) (ok scrut)
- [ go n rhs | (_,_,rhs) <- alts ]
+ go n (Case scrut _ _ alts) = ok scrut &&
+ and [ go n rhs | (_,_,rhs) <- alts ]
go n (Tick t e) | tickishCounts t = False
| otherwise = go n e
go n (Lam x e) | isRuntimeVar x = n==0 || go (n-1) e
More information about the ghc-commits
mailing list