[commit: ghc] ghc-8.6: Suppress -Winaccessible-code in derived code (8bed140)
git at git.haskell.org
git at git.haskell.org
Tue Jul 31 20:34:54 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.6
Link : http://ghc.haskell.org/trac/ghc/changeset/8bed140099f8ab78e3e728fd2e50dd73d7210e84/ghc
>---------------------------------------------------------------
commit 8bed140099f8ab78e3e728fd2e50dd73d7210e84
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date: Tue Jul 24 14:40:42 2018 +0200
Suppress -Winaccessible-code in derived code
Summary:
It's rather unfortunate that derived code can produce inaccessible
code warnings (as demonstrated in #8128, #8740, and #15398), since
the programmer has no control over the generated code. This patch
aims to suppress `-Winaccessible-code` in all derived code. It
accomplishes this by doing the following:
* Generalize the `ic_env :: TcLclEnv` field of `Implication` to
be of type `Env TcGblEnc TcLclEnv` instead. This way, it also
captures `DynFlags`, which record the flag state at the time
the `Implication` was created.
* When typechecking derived code, turn off `-Winaccessible-code`.
This way, any insoluble given `Implication`s that are created when
typechecking this derived code will remember that
`-Winaccessible-code` was disabled.
* During error reporting, consult the `DynFlags` of an
`Implication` before making the decision to report an inaccessible
code warning.
Test Plan: make test TEST="T8128 T8740 T15398"
Reviewers: simonpj, bgamari
Reviewed By: simonpj
Subscribers: monoidal, rwbarton, thomie, carter
GHC Trac Issues: #8128, #8740, #15398
Differential Revision: https://phabricator.haskell.org/D4993
(cherry picked from commit 44a7b9baa45c4ab939c7d996519b5e3de3e13c5a)
>---------------------------------------------------------------
8bed140099f8ab78e3e728fd2e50dd73d7210e84
compiler/typecheck/TcErrors.hs | 33 +++++----
compiler/typecheck/TcInstDcls.hs | 84 ++++++++++++++++++----
compiler/typecheck/TcRnTypes.hs | 66 +++++++++++------
compiler/typecheck/TcSMonad.hs | 34 +++++----
compiler/typecheck/TcSimplify.hs | 39 +++++-----
compiler/typecheck/TcUnify.hs | 38 +++++-----
testsuite/tests/deriving/should_compile/T15398.hs | 20 ++++++
.../tests/deriving/should_compile/T8128.stderr | 14 ----
.../tests/deriving/should_compile/T8740.stderr | 18 -----
testsuite/tests/deriving/should_compile/all.T | 1 +
10 files changed, 209 insertions(+), 138 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8bed140099f8ab78e3e728fd2e50dd73d7210e84
More information about the ghc-commits
mailing list