summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-10-30 09:41:47 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2015-10-30 09:45:49 +0000
commit3e94842d4d1258fbd6a1202bf74d41ce1d01c753 (patch)
tree703ec106f907a72be0d4349a31ca33c44651ee48 /testsuite
parent9376249b6b78610db055a10d05f6592d6bbbea2f (diff)
downloadhaskell-3e94842d4d1258fbd6a1202bf74d41ce1d01c753.tar.gz
Record usage information using GlobalRdrElt
This patch implements an improvment that I've wanted to do for ages, but never gotten around to. Unused imports are computed based on how imported entities occur (qualified, unqualified). This info was accumulated in tcg_used_rdrnames :: Set RdrName. But that was a huge pain, and it got worse when we introduced duplicate record fields. The Right Thing is to record tcg_used_gres :: [GlobalRdrElt], which records the GRE *after* filtering with pickGREs. See Note [GRE filtering] in RdrName. This is much, much bette. This patch deletes quite a bit of code, and is conceptually much easier to follow. Hooray. There should be no change in functionality.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/module/Mod136_A.hs4
-rw-r--r--testsuite/tests/module/mod136.hs3
-rw-r--r--testsuite/tests/module/mod136.stderr12
-rw-r--r--testsuite/tests/rename/should_compile/T4239.stdout2
4 files changed, 12 insertions, 9 deletions
diff --git a/testsuite/tests/module/Mod136_A.hs b/testsuite/tests/module/Mod136_A.hs
index a69d8ee1a3..00cf2c90f1 100644
--- a/testsuite/tests/module/Mod136_A.hs
+++ b/testsuite/tests/module/Mod136_A.hs
@@ -1,3 +1,5 @@
-module Mod136_A (module Data.List) where
+module Mod136_A ( module Data.List ) where
+ -- Only things in scope unqualified (from the Prelude)
+ -- and qualified Data.List.x, will be exported
import qualified Data.List
diff --git a/testsuite/tests/module/mod136.hs b/testsuite/tests/module/mod136.hs
index 1729eea789..c495b685ff 100644
--- a/testsuite/tests/module/mod136.hs
+++ b/testsuite/tests/module/mod136.hs
@@ -1,6 +1,7 @@
-- !!! Re-exporting qualified module.
-module M where
+module M where
+import Prelude () -- Forces the import to come from Mod136_A
import Mod136_A
x = zipWith5
diff --git a/testsuite/tests/module/mod136.stderr b/testsuite/tests/module/mod136.stderr
index 9726cc3cff..fc5e0d682c 100644
--- a/testsuite/tests/module/mod136.stderr
+++ b/testsuite/tests/module/mod136.stderr
@@ -1,6 +1,6 @@
-
-mod136.hs:6:5: error:
- Variable not in scope: zipWith5
- Perhaps you meant one of these:
- ‘zipWith’ (imported from Mod136_A),
- ‘zipWith3’ (imported from Mod136_A)
+
+mod136.hs:7:5: error:
+ Variable not in scope: zipWith5
+ Perhaps you meant one of these:
+ ‘zipWith’ (imported from Mod136_A),
+ ‘zipWith3’ (imported from Mod136_A)
diff --git a/testsuite/tests/rename/should_compile/T4239.stdout b/testsuite/tests/rename/should_compile/T4239.stdout
index 25623f0174..05536b7901 100644
--- a/testsuite/tests/rename/should_compile/T4239.stdout
+++ b/testsuite/tests/rename/should_compile/T4239.stdout
@@ -1 +1 @@
-import T4239A ( type (:+++)((:+++), (:---), X) )
+import T4239A ( type (:+++)((:---), X, (:+++)) )