rebindable-clash-warning-fix : correct warning logic
A warning of the form "The fallible pattern ... is used together with -XRebindableSyntax. If this is intentional compile with -Wno-missing-monad-fail-instances" is colloquially called a "rebindable clash" warning.
If the rebindable syntax and monad fail desugaring language extensions are enabled, rebindable clash warnings are issued irrespective of the setting of -Wmissing-monad-fail-instances
flag. This patch fixes that. Before this patch there was no way to suppress these warnings.
We expect:
- If rebindable syntax is enabled and monad fail desugaring is enabled and the flag
-Wmissing-monadfail-instances
is in effect, rebindable clash warnings should be displayed; - If rebindable syntax is enabled and monad fail desugaring is enabled and the flag
-Wno-missing-monadfail-instances
is in effect, rebindable clash warnings should not be displayed; - If rebindable syntax is enabled and monad fail desugaring is not enabled then rebindable clash warnings should not be displayed.
- If rebindable syntax is not enabled then rebindable clash warnings should not be displayed.
Put another way, we expect rebindable clash warnings iff rebindable syntax is enabled and monad fail desugaring is enabled and the -Wmissing-monad-fail-instances
flag is set.
Program for testing:
{-# LANGUAGE RebindableSyntax, MonadFailDesugaring #-}
{-# OPTIONS_GHC -Wno-missing-monadfail-instances #-}
module Main where
import Prelude
catMaybes xs = do
Just x <- xs
return x
main = print 1
Merge request reports
Activity
Thank you for the excellent commit message! The patch looks right to me.
However, could you add the program in the commit message to the testsuite? See the Wiki for details on how to do this.
Done! Last commit adds two tests @bgamari.
Looks good. Thanks @shayne-fletcher-da!
added 1 commit
- a3289bb6 - rebindable-clash-warning-fix : adjust rebindable12 expect
@bgamari Thanks Ben. There's an adjustment in
rebindable12.stderr
for CI working through the pipeline. Assuming it passes, what's the merge procedure - who/how "hits the button"?added 1 commit
- f1e0abb2 - rebindable-clash-warning-fix : mark test compile_fail
@bgamari Pipeiline is green. This is good for merge!
added 8 commits
-
f1e0abb2...07022297 - 4 commits from branch
ghc:master
- e24c8a80 - rebindable-clash-warning-fix : correct warning logic
- 09cfd094 - rebindable-clash-warning-fix : tests
- 8ca02989 - rebindable-clash-warning-fix : adjust rebindable12 expect
- 4979bf1b - rebindable-clash-warning-fix : mark test compile_fail
Toggle commit list-
f1e0abb2...07022297 - 4 commits from branch