[project @ 2000-05-24 13:36:10 by simonpj]
authorsimonpj <unknown>
Wed, 24 May 2000 13:36:10 +0000 (13:36 +0000)
committersimonpj <unknown>
Wed, 24 May 2000 13:36:10 +0000 (13:36 +0000)
Only report shadowed names in source files (merge with 4.07)

ghc/compiler/rename/RnEnv.lhs

index a87d73c..25e895f 100644 (file)
@@ -260,16 +260,16 @@ bindLocatedLocalsRn :: SDoc       -- Documentation string for error message
 bindLocatedLocalsRn doc_str rdr_names_w_loc enclosed_scope
   = checkDupOrQualNames doc_str rdr_names_w_loc        `thenRn_`
 
+    getModeRn                          `thenRn` \ mode ->
     getLocalNameEnv                    `thenRn` \ name_env ->
-    (if opt_WarnNameShadowing
-     then
-       mapRn_ (check_shadow name_env) rdr_names_w_loc
-     else
-       returnRn ()
+
+       -- Warn about shadowing, but only in source modules
+    (case mode of
+       SourceMode | opt_WarnNameShadowing -> mapRn_ (check_shadow name_env) rdr_names_w_loc
+       other                              -> returnRn ()
     )                                  `thenRn_`
        
     getNameSupplyRn            `thenRn` \ (us, inst_ns, cache, ipcache) ->
-    getModeRn                  `thenRn` \ mode ->
     let
        n          = length rdr_names_w_loc
        (us', us1) = splitUniqSupply us