summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfendor <power.walross@gmail.com>2020-05-22 15:14:24 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-06-01 06:36:18 -0400
commitf3fb1ce9759d1ca57b9ea4acf5518df8d086688e (patch)
tree234d484c99ad9637a69686ab5403827cc88a9951
parent7e5220e25baedfa7ae0ec055c03cb4429dd1af05 (diff)
downloadhaskell-f3fb1ce9759d1ca57b9ea4acf5518df8d086688e.tar.gz
Add `isInScope` check to `lintCoercion`
Mirrors the behaviour of `lintType`.
-rw-r--r--compiler/GHC/Core/Lint.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/GHC/Core/Lint.hs b/compiler/GHC/Core/Lint.hs
index aa650536c3..fbe7d0007f 100644
--- a/compiler/GHC/Core/Lint.hs
+++ b/compiler/GHC/Core/Lint.hs
@@ -1890,7 +1890,12 @@ lintCoercion (CoVarCo cv)
= do { subst <- getTCvSubst
; case lookupCoVar subst cv of
Just linted_co -> return linted_co ;
- Nothing -> -- lintCoBndr always extends the substitition
+ Nothing
+ | cv `isInScope` subst
+ -> return (CoVarCo cv)
+ | otherwise
+ ->
+ -- lintCoBndr always extends the substitition
failWithL $
hang (text "The coercion variable" <+> pprBndr LetBind cv)
2 (text "is out of scope")