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

#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 Keywords: deprecation | Operating System: Unknown/Multiple warning | Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- In the case below a deprecation warning does not show up. {{{#!hs {- ModuleA -} module ModuleA where {-# DEPRECATED func "func is deprecated" #-} func :: Int func = 42 {- ModuleB -} module ModuleB where import ModuleA(func) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15337 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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
participants (1)
-
GHC