diff --git a/compiler/GHC/Tc/Errors/Ppr.hs b/compiler/GHC/Tc/Errors/Ppr.hs index 266290ccb62071807d8e01f10e222251e76c6538..6c875434a6958f109fd16758880b813e6d796f5e 100644 --- a/compiler/GHC/Tc/Errors/Ppr.hs +++ b/compiler/GHC/Tc/Errors/Ppr.hs @@ -1099,8 +1099,11 @@ instance Diagnostic TcRnMessage where , pprWarningTxtForMsg pragma_warning_msg ] where impMsg = text "imported from" <+> ppr pragma_warning_import_mod <> extra - extra | maybe True (pragma_warning_import_mod ==) pragma_warning_defined_mod = empty - | otherwise = text ", but defined in" <+> ppr pragma_warning_defined_mod + extra = case pragma_warning_defined_mod of + Just def_mod + | def_mod /= pragma_warning_import_mod + -> text ", but defined in" <+> ppr def_mod + _ -> empty TcRnDifferentExportWarnings name locs -> mkSimpleDecorated $ vcat [quotes (ppr name) <+> text "exported with different error messages", text "at" <+> vcat (map ppr $ sortBy leftmost_smallest $ NE.toList locs)] diff --git a/testsuite/tests/warnings/should_compile/T23573.hs b/testsuite/tests/warnings/should_compile/T23573.hs new file mode 100644 index 0000000000000000000000000000000000000000..a73fd28aa7fb3625fade75f419c5e50235048cf4 --- /dev/null +++ b/testsuite/tests/warnings/should_compile/T23573.hs @@ -0,0 +1,5 @@ +module T23573 where + +import T23573A + +foo = deprec diff --git a/testsuite/tests/warnings/should_compile/T23573.stderr b/testsuite/tests/warnings/should_compile/T23573.stderr new file mode 100644 index 0000000000000000000000000000000000000000..1f44f590ada82dfa4980ee2f68e056fba36095c9 --- /dev/null +++ b/testsuite/tests/warnings/should_compile/T23573.stderr @@ -0,0 +1,5 @@ + +T23573.hs:5:7: warning: [GHC-68441] [-Wdeprecations (in -Wextended-warnings)] + In the use of ‘deprec’ + (imported from T23573A, but defined in T23573B): + Deprecated: "deprec" diff --git a/testsuite/tests/warnings/should_compile/T23573A.hs b/testsuite/tests/warnings/should_compile/T23573A.hs new file mode 100644 index 0000000000000000000000000000000000000000..73af48fdc9a6c850d3bd1eba2ce27e0fad6bb07e --- /dev/null +++ b/testsuite/tests/warnings/should_compile/T23573A.hs @@ -0,0 +1,5 @@ +module T23573A(module T23573B) where + +import T23573B + + diff --git a/testsuite/tests/warnings/should_compile/T23573B.hs b/testsuite/tests/warnings/should_compile/T23573B.hs new file mode 100644 index 0000000000000000000000000000000000000000..fdb3a570fc20c223a1199d1d866fc60b66cce171 --- /dev/null +++ b/testsuite/tests/warnings/should_compile/T23573B.hs @@ -0,0 +1,4 @@ +module T23573B where + +{-# DEPRECATED deprec "deprec" #-} +deprec = () diff --git a/testsuite/tests/warnings/should_compile/all.T b/testsuite/tests/warnings/should_compile/all.T index cb6e7ac11c0fb03e85b321b52a793cf63e353745..1891470da71b6aeb3e14941625e81f77dda493d8 100644 --- a/testsuite/tests/warnings/should_compile/all.T +++ b/testsuite/tests/warnings/should_compile/all.T @@ -65,3 +65,4 @@ test('DodgyImports_hiding', normal, compile, ['-Wdodgy-imports']) test('T22702a', normal, compile, ['']) test('T22702b', normal, compile, ['']) test('T22826', normal, compile, ['']) +test('T23573', [extra_files(["T23573.hs", "T23573A.hs", "T23573B.hs"])], multimod_compile, ['T23573', '-v0'])