diff options
author | Torsten Schmits <git@tryp.io> | 2022-07-13 16:51:56 +0200 |
---|---|---|
committer | Torsten Schmits <git@tryp.io> | 2022-07-13 16:52:35 +0200 |
commit | b84d26bccbcb87a552d4f6a9f70099b1e5e82dcf (patch) | |
tree | 131463dfddfd2290ec99222a0aa3b0216b3f741a | |
parent | 03958970eebc9c8699d5d2d61c32eb16585100c3 (diff) | |
download | haskell-b84d26bccbcb87a552d4f6a9f70099b1e5e82dcf.tar.gz |
implement some of Ryan's suggestions
-rw-r--r-- | compiler/GHC/Rename/HsType.hs | 12 | ||||
-rw-r--r-- | compiler/GHC/Rename/Module.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/all.T | 0 |
3 files changed, 9 insertions, 6 deletions
diff --git a/compiler/GHC/Rename/HsType.hs b/compiler/GHC/Rename/HsType.hs index 093b6e5b67..1270d1918d 100644 --- a/compiler/GHC/Rename/HsType.hs +++ b/compiler/GHC/Rename/HsType.hs @@ -406,6 +406,13 @@ rnImplicitTvOccs mb_assoc implicit_vs_with_dups thing_inside ; bindLocalNamesFV vars $ thing_inside vars } +-- | This is a wrapper for 'rnImplicitTvOccs' that conditionally introduces new +-- renamed type variables, in particular for the case of implicitly bound variables +-- in type or kind signatures as well as pattern signature binders. +-- If the language extension passed in as the first argument is enabled, renaming will +-- be performed, otherwise an empty list is passed to the continuation. +-- The function was introduced for the extensions @ImplicitForAll@ and +-- @PatternSignatureBinds@, so it is expected to be used with those two in practice. rnImplicitTvOccsIfXopt :: LangExt.Extension -> Maybe assoc -> FreeKiTyVars @@ -1172,11 +1179,8 @@ bindHsOuterTyVarBndrs :: OutputableBndrFlag flag 'Renamed bindHsOuterTyVarBndrs doc mb_cls implicit_vars outer_bndrs thing_inside = case outer_bndrs of HsOuterImplicit{} -> do - implicit_forall <- xoptM LangExt.ImplicitForAll - if implicit_forall - then rnImplicitTvOccs mb_cls implicit_vars $ \implicit_vars' -> do + rnImplicitTvOccsIfXopt LangExt.ImplicitForAll mb_cls implicit_vars $ \implicit_vars' -> thing_inside $ HsOuterImplicit { hso_ximplicit = implicit_vars' } - else thing_inside $ HsOuterImplicit { hso_ximplicit = [] } HsOuterExplicit{hso_bndrs = exp_bndrs} -> -- Note: If we pass mb_cls instead of Nothing below, bindLHsTyVarBndrs -- will use class variables for any names the user meant to bring in diff --git a/compiler/GHC/Rename/Module.hs b/compiler/GHC/Rename/Module.hs index 088981f8ae..3f1dfa9f86 100644 --- a/compiler/GHC/Rename/Module.hs +++ b/compiler/GHC/Rename/Module.hs @@ -1826,8 +1826,7 @@ rnTyClDecl (DataDecl doc = TyDataCtx tycon ; traceRn "rntycl-data" (ppr tycon <+> ppr kvs) ; bindHsQTyVars doc Nothing kvs tyvars $ \ tyvars' no_rhs_kvs -> - do { - ; (defn', fvs) <- rnDataDefn doc defn + do { (defn', fvs) <- rnDataDefn doc defn ; cusk <- data_decl_has_cusk tyvars' new_or_data no_rhs_kvs kind_sig ; let rn_info = DataDeclRn { tcdDataCusk = cusk , tcdFVs = fvs } diff --git a/testsuite/tests/all.T b/testsuite/tests/all.T deleted file mode 100644 index e69de29bb2..0000000000 --- a/testsuite/tests/all.T +++ /dev/null |