[commit: ghc] master: Mention which -Werror promoted a warning to an error (4befb41)

git at git.haskell.org git at git.haskell.org
Tue Jul 11 20:41:50 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/4befb415d7ee63d2b0ecdc2384310dc4b3ccc90a/ghc

>---------------------------------------------------------------

commit 4befb415d7ee63d2b0ecdc2384310dc4b3ccc90a
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date:   Tue Jul 11 15:41:20 2017 -0400

    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


>---------------------------------------------------------------

4befb415d7ee63d2b0ecdc2384310dc4b3ccc90a
 compiler/main/DynFlags.hs                          | 79 ++++++++++++++--------
 compiler/main/ErrUtils.hs                          | 19 +++---
 compiler/main/HscTypes.hs                          | 24 +++++--
 compiler/rename/RnNames.hs                         |  3 +-
 compiler/typecheck/Inst.hs                         |  6 +-
 compiler/typecheck/TcRnExports.hs                  | 16 ++---
 compiler/typecheck/TcRnMonad.hs                    | 19 +++---
 compiler/typecheck/TcSigs.hs                       |  2 +-
 testsuite/tests/driver/T11429c.stderr              |  6 +-
 testsuite/tests/driver/werror.stderr               | 19 +++---
 .../should_fail/overloadedrecfldsfail05.stderr     |  5 +-
 .../should_fail/overloadedrecfldsfail06.stderr     | 11 ++-
 .../should_fail/overloadedrecfldsfail11.stderr     |  5 +-
 .../should_fail/overloadedrecfldsfail12.stderr     |  9 +--
 .../tests/patsyn/should_fail/UnliftedPSBind.stderr |  5 +-
 .../tests/patsyn/should_fail/unboxed-bind.stderr   |  5 +-
 testsuite/tests/rename/should_fail/T5892a.stderr   |  5 +-
 .../tests/safeHaskell/flags/SafeFlags18.stderr     |  7 +-
 .../tests/safeHaskell/flags/SafeFlags23.stderr     |  5 +-
 .../tests/safeHaskell/flags/SafeFlags26.stderr     |  5 +-
 .../safeHaskell/overlapping/SH_Overlap7.stderr     |  5 +-
 .../safeHaskell/safeInfered/UnsafeInfered12.stderr |  5 +-
 testsuite/tests/typecheck/should_fail/T3966.stderr |  5 +-
 .../tests/typecheck/should_fail/tcfail204.stderr   |  5 +-
 .../tests/warnings/should_fail/WerrorFail.stderr   |  6 +-
 .../tests/warnings/should_fail/WerrorFail2.hs      | 19 ++++++
 .../tests/warnings/should_fail/WerrorFail2.stderr  | 16 +++++
 testsuite/tests/warnings/should_fail/all.T         |  1 +
 28 files changed, 169 insertions(+), 148 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 4befb415d7ee63d2b0ecdc2384310dc4b3ccc90a


More information about the ghc-commits mailing list