[GHC] #13512: GHC incorrectly warns that a variable used in a type application is unused

GHC ghc-devs at haskell.org
Thu Aug 3 21:58:11 UTC 2017


#13512: GHC incorrectly warns that a variable used in a type application is unused
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |             Keywords:
      Resolution:                    |  TypeApplications
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  error/warning at compile-time      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * keywords:  TypeApplications, newcomer => TypeApplications


Comment:

 By the way, at one point I looked into how one might fix this bug, but I
 didn't get very far. There's chicken-and-egg problem: the `Unused
 quantified type variable` analysis (and subsequent warning) are done
 entirely within `bindLHsTyVarBndrs`, which is called from `rnValBindsLHS`.
 However, to account for uses of type variables from type annotations or
 visible type applications, we'd need the results of `rnValBindsRHS`, but
 this must be run //after// `rnValBindsLHS`!

 This leads me to believe that either:

 * This `Unused quantified type variable` check shouldn't belong in
 `bindLHsTyVarBndrs`.
 * We need to somehow make `bindLHsTyVarBndrs` aware of function RHSes as
 well for warning purposes.

 Either way, I don't think is quite a newcomer bug :)

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


More information about the ghc-tickets mailing list