[GHC] #15337: Warning not showing up when deprecated variable is explicitly imported

GHC ghc-devs at haskell.org
Mon Jul 9 14:27:36 UTC 2018


#15337: Warning not showing up when deprecated variable is explicitly imported
-------------------------------------+-------------------------------------
        Reporter:  alanasp           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:  deprecation
                                     |  warning
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by tdammers):

 Phab:D4931 reveals an unintended consequence of this mechanism.

 In the case at hand, the `bytestring` package defines and deprecates
 `findSubstrings` in `Data.ByteString`, and then transparently re-exports
 it from `Data.ByteString.Char8`. Conceptually, the transparent re-export
 is not an error; the intention is to just forward the symbol, deprecation
 and all, through the `.Char8` module.

 But in order to re-export the symbol, `.Char8` needs to import it, and
 that does trigger the "importing deprecated symbol" warning.

 However, the situation is only like this because both modules are from the
 same package; if `bytestring` were to explicitly re-export a symbol from
 some other package, and *that* symbol got deprecated, then I'd expect the
 deprecation warning to fire, because in such a case, the intention would
 be to re-export the non-deprecated symbol, and the deprecation flag on it
 would be unexpected from the module author's point of view.

 The again, "package" isn't really a meaningful language-level concept, so
 saying "OK, if this import comes from the same package, then don't warn
 about it" doesn't seem right either.

 Maybe a solution would be to somehow allow marking explicit imports as
 deprecated, which would 1) deprecate the symbol in the current module's
 namespace including re-exports, and 2) silence the deprecation warning
 while compiling the current module.

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


More information about the ghc-tickets mailing list