summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-04-18 02:02:09 +0000
committerBen Gamari <ben@smart-cactus.org>2020-04-18 02:02:09 +0000
commit9710994c7c833b3ffd5c6f1e060cdf40510ba050 (patch)
tree0eb8aa6859c17d805f399c3145ac0acdd4b828ef
parent12decb2a4a78509ef6874c9e6111f9f0e2beeb0b (diff)
downloadhaskell-9710994c7c833b3ffd5c6f1e060cdf40510ba050.tar.gz
Fix CoreLint
-rw-r--r--compiler/GHC/Core/Lint.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/compiler/GHC/Core/Lint.hs b/compiler/GHC/Core/Lint.hs
index 086242ab42..1753f5c6fb 100644
--- a/compiler/GHC/Core/Lint.hs
+++ b/compiler/GHC/Core/Lint.hs
@@ -864,13 +864,23 @@ lintCoreExpr e@(App _ _)
; lintValApp arg3 fun_ty2 arg3_ty }
| Var fun <- fun
+ , fun `hasKey` runRWKey
+ = failWithL (text "Invalid runRW# application")
+
+ | Var fun <- fun
, fun `hasKey` keepAliveIdKey
, [arg_ty1, arg_ty2, arg_ty3, arg_ty4, arg5, arg6, arg7] <- args
- = do { fun_ty5 <- lintCoreArgs (idType fun) [ arg_ty1, arg_ty2, arg_ty3, arg_ty4 ]
+ = do { fun_ty6 <- lintCoreArgs (idType fun)
+ [ arg_ty1, arg_ty2, arg_ty3, arg_ty4, arg5 ]
; arg6_ty <- lintJoinLams 1 (Just fun) arg6 -- f :: State# RW -> (# State# RW, o #)
- ; lintCoreArgs fun_ty5 [arg5, arg6, arg7]
+ ; fun_ty7 <- lintValApp arg6 fun_ty6 arg6_ty
+ ; lintCoreArg fun_ty7 arg7
}
+ | Var fun <- fun
+ , fun `hasKey` keepAliveIdKey
+ = failWithL (text "Invalid keepAlive# application")
+
| otherwise
= do { fun_ty <- lintCoreFun fun (length args)
; lintCoreArgs fun_ty args }