Commit 5231445e authored by simonpj@microsoft.com's avatar simonpj@microsoft.com

Fix Trac #4360: omitted case in combineCtLoc

parent debb7b80
...@@ -999,14 +999,7 @@ doInteractWithInert ...@@ -999,14 +999,7 @@ doInteractWithInert
-- Fall-through case for all other situations -- Fall-through case for all other situations
doInteractWithInert _ workItem = noInteraction workItem doInteractWithInert _ workItem = noInteraction workItem
-------------------------------------------- -------------------------
combineCtLoc :: CtFlavor -> CtFlavor -> WantedLoc
-- Precondition: At least one of them should be wanted
combineCtLoc (Wanted loc) _ = loc
combineCtLoc _ (Wanted loc) = loc
combineCtLoc _ _ = panic "Expected one of wanted constraints (BUG)"
-- Equational Rewriting -- Equational Rewriting
rewriteDict :: (CoVar, TcTyVar, Xi) -> (DictId, CtFlavor, Class, [Xi]) -> TcS CanonicalCt rewriteDict :: (CoVar, TcTyVar, Xi) -> (DictId, CtFlavor, Class, [Xi]) -> TcS CanonicalCt
rewriteDict (cv,tv,xi) (dv,gw,cl,xis) rewriteDict (cv,tv,xi) (dv,gw,cl,xis)
......
...@@ -10,7 +10,7 @@ module TcSMonad ( ...@@ -10,7 +10,7 @@ module TcSMonad (
makeGivens, makeSolved, makeGivens, makeSolved,
CtFlavor (..), isWanted, isGiven, isDerived, canRewrite, CtFlavor (..), isWanted, isGiven, isDerived, canRewrite,
joinFlavors, mkGivenFlavor, combineCtLoc, mkGivenFlavor,
TcS, runTcS, failTcS, panicTcS, traceTcS, traceTcS0, -- Basic functionality TcS, runTcS, failTcS, panicTcS, traceTcS, traceTcS0, -- Basic functionality
tryTcS, nestImplicTcS, wrapErrTcS, wrapWarnTcS, tryTcS, nestImplicTcS, wrapErrTcS, wrapWarnTcS,
...@@ -298,12 +298,13 @@ canRewrite (Derived {}) (Derived {}) = True ...@@ -298,12 +298,13 @@ canRewrite (Derived {}) (Derived {}) = True
canRewrite (Wanted {}) (Wanted {}) = True canRewrite (Wanted {}) (Wanted {}) = True
canRewrite _ _ = False canRewrite _ _ = False
joinFlavors :: CtFlavor -> CtFlavor -> CtFlavor combineCtLoc :: CtFlavor -> CtFlavor -> WantedLoc
joinFlavors (Wanted loc) _ = Wanted loc -- Precondition: At least one of them should be wanted
joinFlavors _ (Wanted loc) = Wanted loc combineCtLoc (Wanted loc) _ = loc
joinFlavors (Derived loc) _ = Derived loc combineCtLoc _ (Wanted loc) = loc
joinFlavors _ (Derived loc) = Derived loc combineCtLoc (Derived loc) _ = loc
joinFlavors (Given loc) _ = Given loc combineCtLoc _ (Derived loc) = loc
combineCtLoc _ _ = panic "combineCtLoc: both given"
mkGivenFlavor :: CtFlavor -> SkolemInfo -> CtFlavor mkGivenFlavor :: CtFlavor -> SkolemInfo -> CtFlavor
mkGivenFlavor (Wanted loc) sk = Given (setCtLocOrigin loc sk) mkGivenFlavor (Wanted loc) sk = Given (setCtLocOrigin loc sk)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment