Add -Werror=compat, enable it in the testsuite
Add a flag
-Werror=compat to GHC which would have the effect of
-Werror=x -Werror=y ... where
x, y, ... are warnings from
-Werror=compat in the testsuite.
-Werror=compatwould be a convenient shorthand to ensure forwards-compatibility of code. I can imagine Haskell libs enabling it on their CI.
-Werror=compatin 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 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="-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
-Wcompat would not cause test failures in all circumstances).
- Add new flags:
-Wwarn=compat. Document these flags in the User's Guide.
-Werror=compatin the testsuite by default and fix all tests that break.