From: simonpj Date: Tue, 23 Apr 2002 08:52:16 +0000 (+0000) Subject: [project @ 2002-04-23 08:52:16 by simonpj] X-Git-Tag: Approx_11550_changesets_converted~2118 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=18f074c56a971ecbaf05957514b7a020cd14e81f;p=ghc-hetmet.git [project @ 2002-04-23 08:52:16 by simonpj] Without -fglasow-exts, quantify over all mentioned type vars in type sigs --- diff --git a/ghc/compiler/rename/RnTypes.lhs b/ghc/compiler/rename/RnTypes.lhs index 4ef0582..afe921d 100644 --- a/ghc/compiler/rename/RnTypes.lhs +++ b/ghc/compiler/rename/RnTypes.lhs @@ -19,6 +19,7 @@ import RdrName ( elemRdrEnv ) import NameSet ( FreeVars ) import Unique ( Uniquable(..) ) +import CmdLineOpts ( DynFlag(Opt_GlasgowExts) ) import List ( nub ) import ListSetOps ( removeDupsEq ) import Outputable @@ -64,11 +65,17 @@ rnHsType doc (HsForAllTy Nothing ctxt ty) -- Given the signature C => T we universally quantify -- over FV(T) \ {in-scope-tyvars} = getLocalNameEnv `thenRn` \ name_env -> + doptRn Opt_GlasgowExts `thenRn` \ opt_GlasgowExts -> let mentioned_in_tau = extractHsTyRdrTyVars ty mentioned_in_ctxt = extractHsCtxtRdrTyVars ctxt mentioned = nub (mentioned_in_tau ++ mentioned_in_ctxt) - forall_tyvars = filter (not . (`elemRdrEnv` name_env)) mentioned + + -- Don't quantify over type variables that are in scope, + -- when GlasgowExts is on + forall_tyvars + | opt_GlasgowExts = filter (not . (`elemRdrEnv` name_env)) mentioned + | otherwise = mentioned in rnForAll doc (map UserTyVar forall_tyvars) ctxt ty