summaryrefslogtreecommitdiff
path: root/testsuite/tests/rename
diff options
context:
space:
mode:
authorHE, Tao <sighingnow@gmail.com>2018-03-19 11:58:26 -0400
committerBen Gamari <ben@smart-cactus.org>2018-03-19 12:05:11 -0400
commitfad822e2a5aa4373c3aa64e913e51fd5509c3f67 (patch)
tree935a0423f9126c19288a14849b4d6fe667680392 /testsuite/tests/rename
parent39c740636dfc7ce4b5590fa60adc6d5ecf5a79b6 (diff)
downloadhaskell-fad822e2a5aa4373c3aa64e913e51fd5509c3f67.tar.gz
Improve the warning message of qualified unused imports.
Pretty-print unused imported names unqualified unconditionally to make the warning message consistent for ambiguous/unambiguous identifiers. Signed-off-by: HE, Tao <sighingnow@gmail.com> Test Plan: make test TEST="T14881" Reviewers: bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie, carter GHC Trac Issues: #14881 Differential Revision: https://phabricator.haskell.org/D4461
Diffstat (limited to 'testsuite/tests/rename')
-rw-r--r--testsuite/tests/rename/should_compile/T14881.hs5
-rw-r--r--testsuite/tests/rename/should_compile/T14881.stderr6
-rw-r--r--testsuite/tests/rename/should_compile/T14881Aux.hs13
-rw-r--r--testsuite/tests/rename/should_compile/all.T1
4 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/tests/rename/should_compile/T14881.hs b/testsuite/tests/rename/should_compile/T14881.hs
new file mode 100644
index 0000000000..c1b955c0f2
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T14881.hs
@@ -0,0 +1,5 @@
+module T14881 where
+
+import qualified T14881Aux as Aux (L(Cons), x, tail, adjust, length)
+
+x = Aux.Cons
diff --git a/testsuite/tests/rename/should_compile/T14881.stderr b/testsuite/tests/rename/should_compile/T14881.stderr
new file mode 100644
index 0000000000..bfb6ca913f
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T14881.stderr
@@ -0,0 +1,6 @@
+[1 of 2] Compiling T14881Aux ( T14881Aux.hs, T14881Aux.o )
+[2 of 2] Compiling T14881 ( T14881.hs, T14881.o )
+
+T14881.hs:3:1: warning: [-Wunused-imports (in -Wextra)]
+ The qualified import of ‘adjust, length, L(tail), L(x)’
+ from module ‘T14881Aux’ is redundant
diff --git a/testsuite/tests/rename/should_compile/T14881Aux.hs b/testsuite/tests/rename/should_compile/T14881Aux.hs
new file mode 100644
index 0000000000..13b8f31d04
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T14881Aux.hs
@@ -0,0 +1,13 @@
+module T14881Aux where
+
+-- unambiguous function name.
+adjust :: ()
+adjust = undefined
+
+-- ambiguous function name.
+length :: ()
+length = undefined
+
+data L = Cons { x :: Int -- unambiguous field selector
+ , tail :: [Int] -- ambiguous field selector
+ }
diff --git a/testsuite/tests/rename/should_compile/all.T b/testsuite/tests/rename/should_compile/all.T
index 4eb584febe..80bcb092e0 100644
--- a/testsuite/tests/rename/should_compile/all.T
+++ b/testsuite/tests/rename/should_compile/all.T
@@ -153,3 +153,4 @@ test('T12548', normal, compile, [''])
test('T13132', normal, compile, [''])
test('T13646', normal, compile, [''])
test('LookupSub', [], multimod_compile, ['LookupSub', '-v0'])
+test('T14881', [], multimod_compile, ['T14881', '-W'])