diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2017-07-11 15:41:20 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-07-11 16:32:43 -0400 |
commit | 4befb415d7ee63d2b0ecdc2384310dc4b3ccc90a (patch) | |
tree | f0baf272b60c130ca4fe4eaf9e7c39c3fa123abb /testsuite/tests/safeHaskell | |
parent | 3a163aabe7948d382393e9e81f1239f3e06b222b (diff) | |
download | haskell-4befb415d7ee63d2b0ecdc2384310dc4b3ccc90a.tar.gz |
Mention which -Werror promoted a warning to an error
Previously -Werror or -Werror=flag printed warnings as usual and then
printed
these two lines:
<no location info>: error:
Failing due to -Werror.
This is not ideal: first, it's not clear which flag made one of the
warnings an
error. Second, warning messages are not modified in any way, so there's
no way
to know which warnings caused this error.
With this patch we (1) promote warning messages to error messages if a
relevant
-Werror is enabled (2) mention which -Werror is used during this
promotion.
Previously:
[1 of 1] Compiling Main ( test.hs, test.o )
test.hs:9:10: warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In a case alternative: Patterns not matched: (C2 _)
|
9 | sInt s = case s of
| ^^^^^^^^^...
test.hs:12:14: warning: [-Wmissing-fields]
• Fields of ‘Rec’ not initialised: f2
• In the first argument of ‘print’, namely ‘Rec {f1 =
1}’
In the expression: print Rec {f1 = 1}
In an equation for ‘main’: main = print Rec {f1 = 1}
|
12 | main = print Rec{ f1 = 1 }
| ^^^^^^^^^^^^^
<no location info>: error:
Failing due to -Werror.
Now:
[1 of 1] Compiling Main ( test.hs, test.o )
test.hs:9:10: error: [-Wincomplete-patterns,
-Werror=incomplete-patterns]
Pattern match(es) are non-exhaustive
In a case alternative: Patterns not matched: (C2 _)
|
9 | sInt s = case s of
| ^^^^^^^^^...
test.hs:12:14: error: [-Wmissing-fields, -Werror=missing-fields]
• Fields of ‘Rec’ not initialised: f2
• In the first argument of ‘print’, namely ‘Rec {f1 =
1}’
In the expression: print Rec {f1 = 1}
In an equation for ‘main’: main = print Rec {f1 = 1}
|
12 | main = print Rec{ f1 = 1 }
| ^^^^^^^^^^^^^
Test Plan: - Update old tests, add new tests if there aren't any
relevant tests
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3709
Diffstat (limited to 'testsuite/tests/safeHaskell')
5 files changed, 6 insertions, 21 deletions
diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags18.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags18.stderr index 7ef83389a8..2766f41512 100644 --- a/testsuite/tests/safeHaskell/flags/SafeFlags18.stderr +++ b/testsuite/tests/safeHaskell/flags/SafeFlags18.stderr @@ -1,6 +1,3 @@ -SafeFlags18.hs:1:16: - Warning: -fpackage-trust ignored; must be specified with a Safe Haskell flag - -<no location info>: -Failing due to -Werror. +SafeFlags18.hs:1:16: error: [-Werror] + -fpackage-trust ignored; must be specified with a Safe Haskell flag diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags23.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags23.stderr index f4e46c2aa8..ea03484823 100644 --- a/testsuite/tests/safeHaskell/flags/SafeFlags23.stderr +++ b/testsuite/tests/safeHaskell/flags/SafeFlags23.stderr @@ -1,10 +1,7 @@ -SafeFlags23.hs:1:16: warning: [-Wunsafe] +SafeFlags23.hs:1:16: error: [-Wunsafe, -Werror=unsafe] ‘SafeFlags22’ has been inferred as unsafe! Reason: SafeFlags23.hs:7:1: error: System.IO.Unsafe: Can't be safely imported! The module itself isn't safe. - -<no location info>: error: -Failing due to -Werror. diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags26.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags26.stderr index bc27ac2a4f..45047aa019 100644 --- a/testsuite/tests/safeHaskell/flags/SafeFlags26.stderr +++ b/testsuite/tests/safeHaskell/flags/SafeFlags26.stderr @@ -1,6 +1,3 @@ -SafeFlags26.hs:1:16: warning: [-Wsafe] +SafeFlags26.hs:1:16: error: [-Wsafe, -Werror=safe] ‘SafeFlags26’ has been inferred as safe! - -<no location info>: error: -Failing due to -Werror. diff --git a/testsuite/tests/safeHaskell/overlapping/SH_Overlap7.stderr b/testsuite/tests/safeHaskell/overlapping/SH_Overlap7.stderr index 8010407cc7..45701f2529 100644 --- a/testsuite/tests/safeHaskell/overlapping/SH_Overlap7.stderr +++ b/testsuite/tests/safeHaskell/overlapping/SH_Overlap7.stderr @@ -2,7 +2,7 @@ [2 of 3] Compiling SH_Overlap7_A ( SH_Overlap7_A.hs, SH_Overlap7_A.o ) [3 of 3] Compiling SH_Overlap7 ( SH_Overlap7.hs, SH_Overlap7.o ) -SH_Overlap7.hs:1:16: warning: [-Wunsafe] +SH_Overlap7.hs:1:16: error: [-Wunsafe, -Werror=unsafe] ‘SH_Overlap7’ has been inferred as unsafe! Reason: SH_Overlap7.hs:14:8: warning: @@ -17,6 +17,3 @@ SH_Overlap7.hs:1:16: warning: [-Wunsafe] instance C [a] -- Defined at SH_Overlap7.hs:10:10 • In the expression: f ([1, 2, 3, 4] :: [Int]) In an equation for ‘test’: test = f ([1, 2, 3, 4] :: [Int]) - -<no location info>: error: -Failing due to -Werror. diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered12.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered12.stderr index 74cf60dc54..f05bf7fa8c 100644 --- a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered12.stderr +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered12.stderr @@ -1,9 +1,6 @@ -UnsafeInfered12.hs:2:16: warning: [-Wunsafe] +UnsafeInfered12.hs:2:16: error: [-Wunsafe, -Werror=unsafe] ‘UnsafeInfered12’ has been inferred as unsafe! Reason: UnsafeInfered12.hs:1:14: -XTemplateHaskell is not allowed in Safe Haskell - -<no location info>: error: -Failing due to -Werror. |