[GHC] #12067: warn-unused-imports does not detect coersions

GHC ghc-devs at haskell.org
Tue Jun 28 12:37:42 UTC 2016


#12067: warn-unused-imports does not detect coersions
-------------------------------------+-------------------------------------
        Reporter:  crockeea          |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #10347            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Simon Peyton Jones <simonpj@…>):

 In [changeset:"23b80ac41cc945cea0fc6ff9ade6b4be8aa81b7f/ghc" 23b80ac/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="23b80ac41cc945cea0fc6ff9ade6b4be8aa81b7f"
 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
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12067#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list