From fc34a5350e9bdba3186ba9c3b3944c33bd7081fb Mon Sep 17 00:00:00 2001
From: sof <unknown>
Date: Tue, 19 Jan 1999 11:39:44 +0000
Subject: [PATCH] [project @ 1999-01-19 11:39:44 by sof] mkExportAvails: remove
 NotAvailable entries corresponding to 'hidden' entities from 'unqual_avails'.
 Not needed and leaving them in causes bother later on in the renamer.

This fixes the problem of compiling

   module B ( module A ) where { import A hiding ( a ) }

Regression test added to check for this - will commit soon.
---
 ghc/compiler/rename/RnEnv.lhs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ghc/compiler/rename/RnEnv.lhs b/ghc/compiler/rename/RnEnv.lhs
index a1c404f83300..6114665c2fb5 100644
--- a/ghc/compiler/rename/RnEnv.lhs
+++ b/ghc/compiler/rename/RnEnv.lhs
@@ -542,7 +542,12 @@ mkExportAvails mod_name unqual_imp name_env avails
 	-- we delete f from avails
 
     unqual_avails | not unqual_imp = []	-- Short cut when no unqualified imports
-		  | otherwise      = [prune avail | avail <- avails]
+		  | otherwise      = [ avail' | avail  <- avails 
+					      , let avail' = prune avail
+					      , case avail' of
+					          NotAvailable -> False
+						  _            -> True
+					      ]
 
     prune (Avail n) | unqual_in_scope n = Avail n
     prune (Avail n) | otherwise		= NotAvailable
-- 
GitLab