summaryrefslogtreecommitdiff
path: root/compiler/typecheck/TcPat.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-06-29 15:26:54 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2017-06-29 15:30:53 +0100
commit3b0e7555fafe73b157a96ca48d8ddc04ad81b231 (patch)
treeea37a910eade51e2346a2e9d49ca8f266974fcf7 /compiler/typecheck/TcPat.hs
parent54ccf0c957a279c20e1a37a5a462612af8036739 (diff)
downloadhaskell-3b0e7555fafe73b157a96ca48d8ddc04ad81b231.tar.gz
Fix lexically-scoped type variables
Trac #13881 showed that our handling of lexically scoped type variables was way off when we bring into scope a name 'y' for a pre-existing type variable 'a', perhaps with an entirely different name. This patch fixes it; see TcHsType Note [Pattern signature binders]
Diffstat (limited to 'compiler/typecheck/TcPat.hs')
-rw-r--r--compiler/typecheck/TcPat.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/typecheck/TcPat.hs b/compiler/typecheck/TcPat.hs
index faadcb3fa3..d10d8474b5 100644
--- a/compiler/typecheck/TcPat.hs
+++ b/compiler/typecheck/TcPat.hs
@@ -406,8 +406,8 @@ tc_pat penv (ViewPat expr pat _) overall_pat_ty thing_inside
tc_pat penv (SigPatIn pat sig_ty) pat_ty thing_inside
= do { (inner_ty, tv_binds, wcs, wrap) <- tcPatSig (inPatBind penv)
sig_ty pat_ty
- ; (pat', res) <- tcExtendTyVarEnv2 wcs $
- tcExtendTyVarEnv tv_binds $
+ ; (pat', res) <- tcExtendTyVarEnv2 wcs $
+ tcExtendTyVarEnv2 tv_binds $
tc_lpat pat (mkCheckExpType inner_ty) penv thing_inside
; pat_ty <- readExpType pat_ty
; return (mkHsWrapPat wrap (SigPatOut pat' inner_ty) pat_ty, res) }