diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-08-05 14:03:34 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-08-05 16:47:05 +0100 |
commit | ab98860871cfac17417d5b55e590445064d21111 (patch) | |
tree | 04d4bbc8eb67c4ba7ac3543b2b3dcb659c9b925f /compiler/rename | |
parent | 49615d9d3a5a25568dc12e4824259439223b44a5 (diff) | |
download | haskell-ab98860871cfac17417d5b55e590445064d21111.tar.gz |
Minor refactor to use filterInScope
Diffstat (limited to 'compiler/rename')
-rw-r--r-- | compiler/rename/RnTypes.hs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/compiler/rename/RnTypes.hs b/compiler/rename/RnTypes.hs index 346d764444..5dfd3fa7ad 100644 --- a/compiler/rename/RnTypes.hs +++ b/compiler/rename/RnTypes.hs @@ -489,17 +489,18 @@ rnHsBndrSig :: HsDocContext rnHsBndrSig doc (HsWB { hswb_cts = ty@(L loc _) }) thing_inside = do { sig_ok <- xoptM Opt_ScopedTypeVariables ; unless sig_ok (badSigErr True doc ty) - ; let (kv_bndrs, tv_bndrs) = extractHsTyRdrTyVars ty - ; name_env <- getLocalRdrEnv - ; tv_names <- newLocalBndrsRn [L loc tv | tv <- tv_bndrs - , not (tv `elemLocalRdrEnv` name_env) ] - ; kv_names <- newLocalBndrsRn [L loc kv | kv <- kv_bndrs - , not (kv `elemLocalRdrEnv` name_env) ] + ; rdr_env <- getLocalRdrEnv + ; let (kv_bndrs, tv_bndrs) = filterInScope rdr_env $ + extractHsTyRdrTyVars ty + ; kv_names <- newLocalBndrsRn (map (L loc) kv_bndrs) + ; tv_names <- newLocalBndrsRn (map (L loc) tv_bndrs) ; bindLocalNamesFV kv_names $ bindLocalNamesFV tv_names $ do { (ty', fvs1, wcs) <- rnLHsTypeWithWildCards doc ty - ; (res, fvs2) <- thing_inside (HsWB { hswb_cts = ty', hswb_kvs = kv_names, - hswb_tvs = tv_names, hswb_wcs = wcs }) + ; (res, fvs2) <- thing_inside (HsWB { hswb_cts = ty' + , hswb_kvs = kv_names + , hswb_tvs = tv_names + , hswb_wcs = wcs }) ; return (res, fvs1 `plusFV` fvs2) } } overlappingKindVars :: HsDocContext -> [RdrName] -> SDoc |