From 18f074c56a971ecbaf05957514b7a020cd14e81f Mon Sep 17 00:00:00 2001 From: simonpj Date: Tue, 23 Apr 2002 08:52:16 +0000 Subject: [PATCH] [project @ 2002-04-23 08:52:16 by simonpj] Without -fglasow-exts, quantify over all mentioned type vars in type sigs --- ghc/compiler/rename/RnTypes.lhs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 -- 1.7.10.4