[commit: ghc] ghc-8.0: Deal correctly with unused imports for 'coerce' (6c28f24)
git at git.haskell.org
git at git.haskell.org
Thu Aug 25 15:04:35 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.0
Link : http://ghc.haskell.org/trac/ghc/changeset/6c28f24aa8202f79db49b85b815011703d647fd9/ghc
>---------------------------------------------------------------
commit 6c28f24aa8202f79db49b85b815011703d647fd9
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Tue Jun 28 12:13:13 2016 +0100
Deal correctly with unused imports for 'coerce'
We only do newtype unwrapping for Coercible constraints if
the newtype's data constructor is in scope. We were trying to
record the fact that the data constructor was thereby 'used', so
that an import statement would not be flagged as unnecsssary
(by -Wunused-imports).
But the code was simply wrong. It was wrong because it assumed
that only one level of unwrapping happened, whereas
tcTopNormaliseNewTypeTF_maybe actually unwraps multiple layers.
So we need to return a /list/ of data constructors that are used.
This entailed a bit of refactoring, as usual.
Fixes Trac #12067
(cherry picked from commit 23b80ac41cc945cea0fc6ff9ade6b4be8aa81b7f)
>---------------------------------------------------------------
6c28f24aa8202f79db49b85b815011703d647fd9
compiler/typecheck/FamInst.hs | 36 ++++++----
compiler/typecheck/TcCanonical.hs | 22 +++---
compiler/typecheck/TcSMonad.hs | 8 +--
compiler/types/Coercion.hs | 80 ++++++++++++----------
compiler/types/FamInstEnv.hs | 2 +-
compiler/types/TyCon.hs | 5 ++
testsuite/tests/typecheck/should_compile/T12067.hs | 9 +++
.../tests/typecheck/should_compile/T12067a.hs | 6 ++
testsuite/tests/typecheck/should_compile/all.T | 2 +
9 files changed, 102 insertions(+), 68 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 6c28f24aa8202f79db49b85b815011703d647fd9
More information about the ghc-commits
mailing list