Make warnings for TH splices opt-in
In #17270 we have the pattern-match checker emit incorrect warnings. The reason for that behavior is ultimately an inconsistency in whether we treat TH splices as written by the user (`FromSource :: Origin`) or as generated code (`Generated`). This was first reported in #14838. The current solution is to TH splices as `Generated` by default and only treat them as `FromSource` when the user requests so (-fenable-th-splice-warnings). There are multiple reasons for opt-in rather than opt-out: * It's not clear that the user that compiles a splice is the author of the code that produces the warning. Think of the situation where she just splices in code from a third-party library that produces incomplete pattern matches. In this scenario, the user isn't even able to fix that warning. * Gathering information for producing the warnings (pattern-match check warnings in particular) is costly. There's no point in doing so if the user is not interested in those warnings. Fixes #17270, but not #14838, because the proper solution needs a GHC proposal extending the TH AST syntax. (cherry picked from commit c2ffcd47)
Showing
- compiler/GHC/Hs/Utils.hs 14 additions, 11 deletionscompiler/GHC/Hs/Utils.hs
- compiler/GHC/ThToHs.hs 46 additions, 38 deletionscompiler/GHC/ThToHs.hs
- compiler/main/DynFlags.hs 2 additions, 0 deletionscompiler/main/DynFlags.hs
- compiler/typecheck/TcGenDeriv.hs 22 additions, 22 deletionscompiler/typecheck/TcGenDeriv.hs
- compiler/typecheck/TcSplice.hs 44 additions, 8 deletionscompiler/typecheck/TcSplice.hs
- docs/users_guide/8.10.1-notes.rst 12 additions, 1 deletiondocs/users_guide/8.10.1-notes.rst
- docs/users_guide/glasgow_exts.rst 11 additions, 0 deletionsdocs/users_guide/glasgow_exts.rst
- testsuite/tests/th/T17270.hs 15 additions, 0 deletionstestsuite/tests/th/T17270.hs
- testsuite/tests/th/TH_repUnboxedTuples.stderr 0 additions, 8 deletionstestsuite/tests/th/TH_repUnboxedTuples.stderr
- testsuite/tests/th/all.T 2 additions, 0 deletionstestsuite/tests/th/all.T
Loading
Please register or sign in to comment