[commit: ghc] master: Fix testsuite failures after the PartialTypeSignatures merge (d108a19)

git at git.haskell.org git at git.haskell.org
Sat Nov 29 17:34:07 UTC 2014


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

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

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

commit d108a19cf6cd802c30ff1fa2758dd6aa8c049ad0
Author: Thomas Winant <thomas.winant at cs.kuleuven.be>
Date:   Sat Nov 29 11:34:36 2014 -0600

    Fix testsuite failures after the PartialTypeSignatures merge
    
    Summary:
    Properly detect insoluble wanteds
    
    This used to be correct, but was recently incorrectly refactored.
    
    Reviewers: austin, hvr
    
    Reviewed By: austin, hvr
    
    Subscribers: thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D531


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

d108a19cf6cd802c30ff1fa2758dd6aa8c049ad0
 compiler/typecheck/TcRnTypes.lhs | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/compiler/typecheck/TcRnTypes.lhs b/compiler/typecheck/TcRnTypes.lhs
index e14733c..cc9a769 100644
--- a/compiler/typecheck/TcRnTypes.lhs
+++ b/compiler/typecheck/TcRnTypes.lhs
@@ -49,7 +49,7 @@ module TcRnTypes(
         isEmptyCts, isCTyEqCan, isCFunEqCan,
         isCDictCan_Maybe, isCFunEqCan_maybe,
         isCIrredEvCan, isCNonCanonical, isWantedCt, isDerivedCt,
-        isGivenCt, isHoleCt, isTypedHoleCt,
+        isGivenCt, isHoleCt, isTypedHoleCt, isPartialTypeSigCt,
         ctEvidence, ctLoc, ctPred,
         mkNonCanonical, mkNonCanonicalCt,
         ctEvPred, ctEvLoc, ctEvTerm, ctEvCoercion, ctEvId, ctEvCheckDepth,
@@ -1248,6 +1248,10 @@ isHoleCt _ = False
 isTypedHoleCt :: Ct -> Bool
 isTypedHoleCt (CHoleCan { cc_hole = ExprHole }) = True
 isTypedHoleCt _ = False
+
+isPartialTypeSigCt :: Ct -> Bool
+isPartialTypeSigCt (CHoleCan { cc_hole = TypeHole }) = True
+isPartialTypeSigCt _ = False
 \end{code}
 
 \begin{code}
@@ -1331,11 +1335,11 @@ isEmptyWC (WC { wc_flat = f, wc_impl = i, wc_insol = n })
   = isEmptyBag f && isEmptyBag i && isEmptyBag n
 
 insolubleWC :: WantedConstraints -> Bool
--- True if there are any insoluble constraints in the wanted bag
-insolubleWC wc = not (isEmptyBag (filterBag isTypedHoleCt (wc_insol wc)))
--- TODOT actually, a wildcard constraint (CHoleCan originating from a wildcard
--- in a partial type signature) is not insulible.
--- insolubleWC wc = not (isEmptyBag (wc_insol wc))
+-- True if there are any insoluble constraints in the wanted bag. Ignore
+-- constraints arising from PartialTypeSignatures to solve as much of the
+-- constraints as possible before reporting the holes.
+insolubleWC wc = not (isEmptyBag (filterBag (not . isPartialTypeSigCt)
+                                  (wc_insol wc)))
                || anyBag ic_insol (wc_impl wc)
 
 andWC :: WantedConstraints -> WantedConstraints -> WantedConstraints



More information about the ghc-commits mailing list