summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2015-07-25 09:37:44 +0100
committerSergei Trofimovich <siarheit@google.com>2015-07-25 09:39:03 +0100
commitb04bed0a391335e70b3c3bdbdccbaa0781697cce (patch)
tree23aa621d8bf8fc048504b6eb2854a79a41c275d4
parent09d05050346c1be7bac20ba3f40861e05217368b (diff)
downloadhaskell-b04bed0a391335e70b3c3bdbdccbaa0781697cce.tar.gz
renamer: fix module-level deprecation message
Noticed today that deprecation warnings are slightly broken in -HEAD: mtl-2.2.1/Control/Monad/Error/Class.hs:46:1: warning: Module ‘Control.Monad.Trans.Error’ is deprecated: ([", U, s, e, , C, o, n, t, r, o, l, ., M, o, n, a, d, ., T, r, a, n, s, ., E, x, c, e, p, t, , i, n, s, t, e, a, d, "], Use Control.Monad.Trans.Except instead) Commit e6191d1cc37e98785af8b309100ea840084fa3ba slightly changed WarningTxt declaration: -data WarningTxt = WarningTxt (Located SourceText) [Located FastString] - | DeprecatedTxt (Located SourceText) [Located FastString] +data WarningTxt = WarningTxt (Located SourceText) + [Located (SourceText,FastString)] + | DeprecatedTxt (Located SourceText) + [Located (SourceText,FastString)] But 'moduleWarn' function was not updated to do the stripping. Signed-off-by: Sergei Trofimovich <siarheit@google.com> Reviewers: austin, bgamari, hvr, goldfire, rwbarton, alanz Reviewed By: rwbarton, alanz Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1096 GHC Trac Issues: #10313
-rw-r--r--compiler/rename/RnNames.hs4
-rw-r--r--testsuite/tests/warnings/should_compile/DeprM.hs4
-rw-r--r--testsuite/tests/warnings/should_compile/DeprU.hs6
-rw-r--r--testsuite/tests/warnings/should_compile/DeprU.stderr10
-rw-r--r--testsuite/tests/warnings/should_compile/all.T6
5 files changed, 28 insertions, 2 deletions
diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs
index 0c116dfa6b..aeb0388673 100644
--- a/compiler/rename/RnNames.hs
+++ b/compiler/rename/RnNames.hs
@@ -1788,11 +1788,11 @@ missingImportListItem ie
moduleWarn :: ModuleName -> WarningTxt -> SDoc
moduleWarn mod (WarningTxt _ txt)
= sep [ ptext (sLit "Module") <+> quotes (ppr mod) <> ptext (sLit ":"),
- nest 2 (vcat (map ppr txt)) ]
+ nest 2 (vcat (map (ppr . snd . unLoc) txt)) ]
moduleWarn mod (DeprecatedTxt _ txt)
= sep [ ptext (sLit "Module") <+> quotes (ppr mod)
<+> ptext (sLit "is deprecated:"),
- nest 2 (vcat (map ppr txt)) ]
+ nest 2 (vcat (map (ppr . snd . unLoc) txt)) ]
packageImportErr :: SDoc
packageImportErr
diff --git a/testsuite/tests/warnings/should_compile/DeprM.hs b/testsuite/tests/warnings/should_compile/DeprM.hs
new file mode 100644
index 0000000000..2a84622e21
--- /dev/null
+++ b/testsuite/tests/warnings/should_compile/DeprM.hs
@@ -0,0 +1,4 @@
+module DeprM {-# DEPRECATED "Here can be your menacing deprecation warning!" #-} where
+
+f :: Int
+f = 42
diff --git a/testsuite/tests/warnings/should_compile/DeprU.hs b/testsuite/tests/warnings/should_compile/DeprU.hs
new file mode 100644
index 0000000000..d15a7c51f7
--- /dev/null
+++ b/testsuite/tests/warnings/should_compile/DeprU.hs
@@ -0,0 +1,6 @@
+module A where
+
+import DeprM -- here should be emitted deprecation warning
+
+g :: Int
+g = f
diff --git a/testsuite/tests/warnings/should_compile/DeprU.stderr b/testsuite/tests/warnings/should_compile/DeprU.stderr
new file mode 100644
index 0000000000..c27dccb474
--- /dev/null
+++ b/testsuite/tests/warnings/should_compile/DeprU.stderr
@@ -0,0 +1,10 @@
+[1 of 2] Compiling DeprM ( DeprM.hs, DeprM.o )
+[2 of 2] Compiling A ( DeprU.hs, DeprU.o )
+
+DeprU.hs:3:1: Warning:
+ Module ‘DeprM’ is deprecated:
+ Here can be your menacing deprecation warning!
+
+DeprU.hs:6:5: Warning:
+ In the use of ‘f’ (imported from DeprM):
+ Deprecated: "Here can be your menacing deprecation warning!"
diff --git a/testsuite/tests/warnings/should_compile/all.T b/testsuite/tests/warnings/should_compile/all.T
index 7fa8caf584..bbf5d1cc85 100644
--- a/testsuite/tests/warnings/should_compile/all.T
+++ b/testsuite/tests/warnings/should_compile/all.T
@@ -4,3 +4,9 @@ test('T9178', extra_clean(['T9178.o', 'T9178DataType.o',
'T9178.hi', 'T9178DataType.hi']),
multimod_compile, ['T9178', '-Wall'])
test('T9230', normal, compile_without_flag('-fno-warn-tabs'), [''])
+
+test('DeprU',
+ extra_clean([
+ 'DeprM.o', 'DeprU.o',
+ 'DeprM.hi', 'DeprU.hi']),
+ multimod_compile, ['DeprU', '-Wall'])