summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Gen
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2021-01-08 18:42:14 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-17 05:54:19 -0500
commit62cac31cd20708d7dd77131e0f822a3eed0d0661 (patch)
treed0b5733950a039bea3bef1b38a013c71d05e3c93 /compiler/GHC/Tc/Gen
parent66414bdf40534f07ac730e25f78e591994d2c1e4 (diff)
downloadhaskell-62cac31cd20708d7dd77131e0f822a3eed0d0661.tar.gz
Fix unsoundness for linear guards (#19120)
Diffstat (limited to 'compiler/GHC/Tc/Gen')
-rw-r--r--compiler/GHC/Tc/Gen/Match.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/Gen/Match.hs b/compiler/GHC/Tc/Gen/Match.hs
index 1b9e0185f3..3d20305c88 100644
--- a/compiler/GHC/Tc/Gen/Match.hs
+++ b/compiler/GHC/Tc/Gen/Match.hs
@@ -395,7 +395,8 @@ tcStmtsAndThen ctxt stmt_chk (L loc stmt : stmts) res_ty thing_inside
tcGuardStmt :: TcExprStmtChecker
tcGuardStmt _ (BodyStmt _ guard _ _) res_ty thing_inside
- = do { guard' <- tcCheckMonoExpr guard boolTy
+ = do { guard' <- tcScalingUsage Many $ tcCheckMonoExpr guard boolTy
+ -- Scale the guard to Many (see #19120 and #19193)
; thing <- thing_inside res_ty
; return (BodyStmt boolTy guard' noSyntaxExpr noSyntaxExpr, thing) }