From bfce9573fc285187e0dc56f1bad4a02d5b00d38c Mon Sep 17 00:00:00 2001
From: sof <unknown>
Date: Mon, 20 Jul 1998 16:15:28 +0000
Subject: [PATCH] [project @ 1998-07-20 16:15:28 by sof] importDecl: Improved
 warning message for (attempted) reflexive import

---
 ghc/compiler/rename/RnIfaces.lhs | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/ghc/compiler/rename/RnIfaces.lhs b/ghc/compiler/rename/RnIfaces.lhs
index b42efb05c156..2b3d04cc24b3 100644
--- a/ghc/compiler/rename/RnIfaces.lhs
+++ b/ghc/compiler/rename/RnIfaces.lhs
@@ -419,7 +419,8 @@ importDecl (name, loc) mode
          mod = nameModule name
        in
        if mod == this_mod  then    -- Don't bring in decls from
-	  pprTrace "importDecl wierdness:" (ppr name) $
+	  addWarnRn (importDeclWarn mod name loc) `thenRn_`
+--	  pprTrace "importDecl wierdness:" (ppr name) $
 	  returnRn Nothing         -- the renamed module's own interface file
 			           -- 
        else
@@ -1075,6 +1076,15 @@ getDeclErr name loc
          quotes (ppr name), ptext SLIT("needed at"), ppr loc]
 
 getDeclWarn name loc
-  = sep [ptext SLIT("Warning: failed to find (optional) interface decl for"), 
+  = sep [ptext SLIT("Failed to find (optional) interface decl for"), 
          quotes (ppr name), ptext SLIT("desired at"), ppr loc]
+
+importDeclWarn mod name loc
+  = sep [ptext SLIT("Compiler tried to import decl from interface file with same name as module."), 
+	 ptext SLIT("(possible cause: module name clashes with interface file already in scope.)")
+	] $$
+    hsep [ptext SLIT("Interface:"), quotes (pprModule mod), ptext SLIT(", name:"), quotes (ppr name), 
+	  ptext SLIT(", desired at:"), ppr loc
+         ]
+
 \end{code}
-- 
GitLab