[GHC] #15398: GADT deriving Ord generates inaccessible code in a pattern with constructor.
GHC
ghc-devs at haskell.org
Wed Jul 18 21:22:05 UTC 2018
#15398: GADT deriving Ord generates inaccessible code in a pattern with
constructor.
-------------------------------------+-------------------------------------
Reporter: philderbeast | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.2.2
Resolution: | Keywords: deriving,
| PatternMatchWarnings
Operating System: MacOS X | Architecture: x86_64
| (amd64)
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
> I thought you were requesting that we never emit inaccessible code
warnings for derived code (regardless of whether -Winaccessible-code is
enabled or not).
Correct. So if we switch off `-Winaccessible-code` when typechecking
derived code, that would do job. And we try to; see
{{{
-- Now GHC-generated derived bindings, generics, and
selectors
-- Do not generate warnings from compiler-generated code;
-- hence the use of discardWarnings
tc_envs@(tcg_env, tcl_env)
<- discardWarnings (tcTopBinds deriv_binds deriv_sigs) ;
}}}
in `TcRnDriver`. Unfortunately the `dicardWarnings` only discards warnings
generated while doing `tcTopBinds`. But `tcTopBinds` also creates a bunch
of constraints that don't "see" that `discardWarnings`.
If instead switched off the warning `DynFlags`, and captured the
`DynFlags` in an implication, the warning suppression would still work on
the constraints.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15398#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list