diff options
author | fendor <power.walross@gmail.com> | 2020-05-22 15:14:24 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-06-01 06:36:18 -0400 |
commit | f3fb1ce9759d1ca57b9ea4acf5518df8d086688e (patch) | |
tree | 234d484c99ad9637a69686ab5403827cc88a9951 | |
parent | 7e5220e25baedfa7ae0ec055c03cb4429dd1af05 (diff) | |
download | haskell-f3fb1ce9759d1ca57b9ea4acf5518df8d086688e.tar.gz |
Add `isInScope` check to `lintCoercion`
Mirrors the behaviour of `lintType`.
-rw-r--r-- | compiler/GHC/Core/Lint.hs | 7 |
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") |