Simon Peyton Jones pushed to branch wip/T23162-part2 at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • compiler/GHC/Tc/Solver/FunDeps.hs
    ... ... @@ -1089,7 +1089,7 @@ solveFunDeps work_ev fd_eqns
    1089 1089
       = return (False, False) -- Common case no-op
    
    1090 1090
     
    
    1091 1091
       | otherwise
    
    1092
    -  = do { traceTcS "bumping" (ppr work_ev)
    
    1092
    +  = do { traceTcS "solveFunDeps {" (ppr work_ev)
    
    1093 1093
            ; loc' <- bumpReductionDepth (ctEvLoc work_ev) (ctEvPred work_ev)
    
    1094 1094
                      -- See (CF3) in Note [Exploiting closed type families]
    
    1095 1095
     
    
    ... ... @@ -1097,7 +1097,7 @@ solveFunDeps work_ev fd_eqns
    1097 1097
                  <- reportFineGrainUnifications $
    
    1098 1098
                     nestFunDepsTcS              $
    
    1099 1099
                     TcS.pushTcLevelM_           $
    
    1100
    -                   -- pushTcLevelTcM: increase the level so that unification variables
    
    1100
    +                   -- pushTcLevelTcM: increase the level so that unification variablesb
    
    1101 1101
                        -- allocated by the fundep-creation itself don't count as useful unifications
    
    1102 1102
                        -- See Note [Deeper TcLevel for partial improvement unification variables]
    
    1103 1103
                     do { (_, eqs) <- wrapUnifier (ctEvRewriters work_ev) loc' Nominal $
    
    ... ... @@ -1111,7 +1111,12 @@ solveFunDeps work_ev fd_eqns
    1111 1111
            -- that were unified by the fundep
    
    1112 1112
            ; kickOutAfterUnification unifs
    
    1113 1113
     
    
    1114
    -       ; return (insolubleWC residual, not (isEmptyVarSet unifs)) }
    
    1114
    +       ; let insoluble_fundeps = any insolubleCt (wc_simple residual)
    
    1115
    +             -- Don't use insolubleWC, because that ignores Given constraints
    
    1116
    +             -- and Given constraints are super-important when doing
    
    1117
    +             -- tcCheckGivens in the pattern match overlap checker
    
    1118
    +       ; traceTcS "solveFunDeps }" (ppr insoluble_fundeps <+>  ppr unifs $$ ppr residual)
    
    1119
    +       ; return (insoluble_fundeps, not (isEmptyVarSet unifs)) }
    
    1115 1120
                -- insolubleWC: see (CF3) in Note [Exploiting closed type families]
    
    1116 1121
       where
    
    1117 1122
         do_fundeps :: UnifyEnv -> TcM ()