[commit: ghc] master: Attach warnings to non-PVP compatible uses of signatures. (9f169bc)

git at git.haskell.org git at git.haskell.org
Wed Jan 11 14:54:24 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/9f169bcd951c5d946698d5f33a0cdb625d725490/ghc

>---------------------------------------------------------------

commit 9f169bcd951c5d946698d5f33a0cdb625d725490
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Thu Dec 29 18:58:22 2016 -0800

    Attach warnings to non-PVP compatible uses of signatures.
    
    Summary:
    If you use an inherited signature from another package in your own code,
    the only valid PVP bound you can specify for this package is an *exact*
    version bound.  This is because the signature is used both covariantly
    (it provides declarations for import) and contravariantly (it specifies
    what is required).  However, this is a bit distressing if you want to
    use a PVP-style bound that allows for upgrading a package.  So there is
    a dichotomy:
    
        1. Any signatures that come from packages with exact bounds
        (this includes, in particular, signature packages, who are
        included solely to make declarations available), can be
        used without problem by modules, but
    
        2. Any signatures that come from packages that are version
        bounded (i.e., any package that also provides modules) must
        NOT be used, because if they were used, they could break
        under a PVP policy that allows relaxations in the needed
        requirements.
    
    To help users avoid situation (2), I've added a warning to all
    signature declarations that come solely from (2).  This is not
    perfect; you might still end up relying on some type identity
    specified by a signature in a version-bounded package, but it
    should help catch major errors.
    
    Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>
    
    Test Plan: validate
    
    Reviewers: simonpj, austin, bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2906


>---------------------------------------------------------------

9f169bcd951c5d946698d5f33a0cdb625d725490
 compiler/typecheck/TcBackpack.hs                   | 51 +++++++++++++++++++---
 .../tests/backpack/should_compile/bkp10.stderr     |  4 ++
 .../tests/backpack/should_compile/bkp11.stderr     |  8 ++++
 .../tests/backpack/should_compile/bkp24.stderr     |  4 ++
 .../tests/backpack/should_compile/bkp36.stderr     |  4 ++
 5 files changed, 64 insertions(+), 7 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9f169bcd951c5d946698d5f33a0cdb625d725490


More information about the ghc-commits mailing list