Skip to content
Snippets Groups Projects
Forked from Glasgow Haskell Compiler / GHC
Source project has a limited visibility.
  • Bartłomiej Cieślar's avatar
    711b1d24
    Add support for deprecating exported items (proposal #134) · 711b1d24
    Bartłomiej Cieślar authored and Ben Gamari's avatar Ben Gamari committed
    
    This is an implementation of the deprecated exports proposal #134.
    The proposal introduces an ability to introduce warnings to exports.
    This allows for deprecating a name only when it is exported from a specific
    module, rather than always depreacting its usage. In this example:
    
        module A ({-# DEPRECATED "do not use" #-} x) where
        x = undefined
        ---
        module B where
        import A(x)
    
    `x` will emit a warning when it is explicitly imported.
    
    Like the declaration warnings, export warnings are first accumulated within
    the `Warnings` struct, then passed into the ModIface, from which they are
    then looked up and warned about in the importing module in the `lookup_ie`
    helpers of the `filterImports` function (for the explicitly imported names)
    and in the `addUsedGRE(s)` functions where they warn about regular usages
    of the imported name.
    
    In terms of the AST information, the custom warning is stored in the
    extension field of the variants of the `IE` type (see Trees that Grow for
    more information).
    
    The commit includes a bump to the haddock submodule added in MR #28
    
    Signed-off-by: default avatarBartłomiej Cieślar <bcieslar2001@gmail.com>
    711b1d24
    History
    Add support for deprecating exported items (proposal #134)
    Bartłomiej Cieślar authored and Ben Gamari's avatar Ben Gamari committed
    
    This is an implementation of the deprecated exports proposal #134.
    The proposal introduces an ability to introduce warnings to exports.
    This allows for deprecating a name only when it is exported from a specific
    module, rather than always depreacting its usage. In this example:
    
        module A ({-# DEPRECATED "do not use" #-} x) where
        x = undefined
        ---
        module B where
        import A(x)
    
    `x` will emit a warning when it is explicitly imported.
    
    Like the declaration warnings, export warnings are first accumulated within
    the `Warnings` struct, then passed into the ModIface, from which they are
    then looked up and warned about in the importing module in the `lookup_ie`
    helpers of the `filterImports` function (for the explicitly imported names)
    and in the `addUsedGRE(s)` functions where they warn about regular usages
    of the imported name.
    
    In terms of the AST information, the custom warning is stored in the
    extension field of the variants of the `IE` type (see Trees that Grow for
    more information).
    
    The commit includes a bump to the haddock submodule added in MR #28
    
    Signed-off-by: default avatarBartłomiej Cieślar <bcieslar2001@gmail.com>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.