summaryrefslogtreecommitdiff
path: root/compiler/rename
diff options
context:
space:
mode:
authorMatthew Yacavone <matthew@yacavone.net>2018-11-29 18:42:39 -0500
committerRyan Scott <ryan.gl.scott@gmail.com>2018-11-29 18:44:13 -0500
commitfe57a5bae3f8cb87637359f615c77f4afae86d46 (patch)
treed36f6a009aa8c027e8b02b032301ec1c535b787e /compiler/rename
parent2257a86daa72db382eb927df12a718669d5491f8 (diff)
downloadhaskell-fe57a5bae3f8cb87637359f615c77f4afae86d46.tar.gz
Fix #15828, from `More explicit foralls`
Summary: Fix a bug in commit 12eeb9 which permits the following: ``` class C a where type T a b instance C (Maybe a) where type forall a b. T (Maybe a) b = b ``` where instead, the user should write: ``` instance C (Maybe a) where type forall b. T (Maybe a) b = b ``` Update the users guide to discuss scoping of type variables in explicit foralls in type family instances. Test Plan: validate Reviewers: bgamari, goldfire, monoidal Reviewed By: goldfire Subscribers: monoidal, rwbarton, carter GHC Trac Issues: #15828 Differential Revision: https://phabricator.haskell.org/D5283
Diffstat (limited to 'compiler/rename')
-rw-r--r--compiler/rename/RnSource.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rename/RnSource.hs b/compiler/rename/RnSource.hs
index 7a205ba3b9..6027110f36 100644
--- a/compiler/rename/RnSource.hs
+++ b/compiler/rename/RnSource.hs
@@ -738,7 +738,12 @@ rnFamInstEqn doc mb_cls rhs_kvars
; ((bndrs', pats', payload'), fvs)
<- bindLocalNamesFV all_imp_var_names $
bindLHsTyVarBndrs doc (Just $ inHsDocContext doc)
- mb_cls bndrs $ \bndrs' ->
+ Nothing bndrs $ \bndrs' ->
+ -- Note: If we pass mb_cls instead of Nothing here,
+ -- bindLHsTyVarBndrs will use class variables for any names
+ -- the user meant to bring in scope here. This is an explicit
+ -- forall, so we want fresh names, not class variables.
+ -- Thus: always pass Nothing
do { (pats', pat_fvs) <- rnLHsTypes (FamPatCtx tycon) pats
; (payload', rhs_fvs) <- rn_payload doc payload