diff options
author | Thomas Winant <thomas.winant@cs.kuleuven.be> | 2014-11-29 11:34:36 -0600 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-11-29 11:34:37 -0600 |
commit | d108a19cf6cd802c30ff1fa2758dd6aa8c049ad0 (patch) | |
tree | b6124c12618cdd429bb2eb0d9affc26043db15c2 | |
parent | 447f592697fef04d1e19a2045ec707cfcd1eb59f (diff) | |
download | haskell-d108a19cf6cd802c30ff1fa2758dd6aa8c049ad0.tar.gz |
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
-rw-r--r-- | compiler/typecheck/TcRnTypes.lhs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/compiler/typecheck/TcRnTypes.lhs b/compiler/typecheck/TcRnTypes.lhs index e14733c587..cc9a7699e2 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 |