[GHC] #15278: Add -Werror=compat, enable it in the testsuite

GHC ghc-devs at haskell.org
Sun Jun 17 00:41:11 UTC 2018


#15278: Add -Werror=compat, enable it in the testsuite
-------------------------------------+-------------------------------------
           Reporter:  int-index      |             Owner:  (none)
               Type:  task           |            Status:  new
           Priority:  normal         |         Milestone:  8.8.1
          Component:  Compiler       |           Version:
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 = Proposed change

 Add a flag `-Werror=compat` to GHC which would have the effect of
 `-Werror=x -Werror=y ...` where `x, y, ...` are warnings from
 `minusWcompatOpts`. Enable `-Wcompat -Werror=compat` in the testsuite.

 = Motivation

 1. `-Werror=compat` would be a convenient shorthand to ensure forwards-
 compatibility of code. I can imagine Haskell libs enabling it on their CI.

 2. Enabling `-Wcompat -Werror=compat` in the testsuite would allow us to
 easily see the impact that a new warning has on code. It also means that
 in the period between adding the warning and making the actual breaking
 change, all new test cases that are being added to the testsuite will be
 forwards-compatible. This is good because it will make the actual breaking
 change contain less irrelevant testsuite updates.

 The idea came up during my work on Phab:D4834 which defines a new warning
 and adds it to `-Wcompat`. Ryan Scott raised the following concern:

 > There are likely many tests in the testsuite that will now fail due to
 this changeā€”I'm unclear if you're intending to fix them by explicitly
 quantifying their kind variables, or leaving the new error message as-is.

 My intention was to update the test cases, but it turned out that I
 couldn't even locate these test cases without `make EXTRA_HC_OPTS="-fwarn-
 implicit-kind-vars -Werror=implicit-kind-vars"`. And even if I updated the
 testsuite, nothing would prevent new test cases that are not forwards-
 compatible, because the warning isn't enabled by default (and without
 `-Werror=compat`, enabling `-Wcompat` would not cause test failures in all
 circumstances).

 = Implementation plan

 1. Add new flags: `-Werror=compat`, `-Wno-error=compat`, `-Wwarn=compat`.
 2. Document these flags in the User's Guide.
 3. Enable `-Wcompat -Werror=compat` in the testsuite by default and fix
 all tests that break.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15278>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list