Commit b04bed0a authored by Sergei Trofimovich's avatar Sergei Trofimovich Committed by Sergei Trofimovich

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 e6191d1c
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: default avatarSergei Trofimovich <>

Reviewers: austin, bgamari, hvr, goldfire, rwbarton, alanz

Reviewed By: rwbarton, alanz

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10313
parent 09d05050
......@@ -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
module DeprM {-# DEPRECATED "Here can be your menacing deprecation warning!" #-} where
f :: Int
f = 42
module A where
import DeprM -- here should be emitted deprecation warning
g :: Int
g = f
[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!"
......@@ -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'), [''])
'DeprM.o', 'DeprU.o',
'DeprM.hi', 'DeprU.hi']),
multimod_compile, ['DeprU', '-Wall'])
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment