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

Commits:

2 changed files:

Changes:

  • compiler/GHC/Tc/Errors.hs
    ... ... @@ -648,6 +648,7 @@ reportWanteds ctxt tc_lvl wc@(WC { wc_simple = simples, wc_impl = implics
    648 648
                   , ("Homo eqs",      is_homo_equality,  True,  mkGroupReporter mkEqErr)
    
    649 649
                   , ("Other eqs",     is_equality,       True,  mkGroupReporter mkEqErr)
    
    650 650
     
    
    651
    +              , ("Insoluble fundeps", is_insoluble_fundep, True, mkGroupReporter mkDictErr)
    
    651 652
                   ]
    
    652 653
     
    
    653 654
         -- report2: we suppress these if there are insolubles elsewhere in the tree
    
    ... ... @@ -665,6 +666,11 @@ reportWanteds ctxt tc_lvl wc@(WC { wc_simple = simples, wc_impl = implics
    665 666
            | otherwise         = False
    
    666 667
            -- I think all given residuals are equalities
    
    667 668
     
    
    669
    +    -- Constraints that have insoluble functional dependencies
    
    670
    +    is_insoluble_fundep item _ = case ei_m_reason item of
    
    671
    +           Just InsolubleFunDepReason -> True
    
    672
    +           _                          -> False
    
    673
    +
    
    668 674
         -- Things like (Int ~N Bool)
    
    669 675
         utterly_wrong _ (EqPred NomEq ty1 ty2) = isRigidTy ty1 && isRigidTy ty2
    
    670 676
         utterly_wrong _ _                      = False
    

  • compiler/GHC/Tc/Errors/Types.hs
    ... ... @@ -5423,7 +5423,7 @@ getUserGivens (CEC {cec_encl = implics}) = getUserGivensFromImplics implics
    5423 5423
     -- that will give rise to a diagnostic.
    
    5424 5424
     data ErrorItem
    
    5425 5425
     -- We could perhaps use Ct here (and indeed used to do exactly that), but
    
    5426
    --- having a separate type gives to denote errors-in-formation gives us
    
    5426
    +-- having a separate type to denote error-information gives us
    
    5427 5427
     -- a nice place to do pre-processing, such as calculating ei_suppress.
    
    5428 5428
     -- Perhaps some day, an ErrorItem could eventually evolve to contain
    
    5429 5429
     -- the error text (or some representation of it), so we can then have all
    
    ... ... @@ -5436,7 +5436,7 @@ data ErrorItem
    5436 5436
              --   for Givens, Nothing
    
    5437 5437
            , ei_flavour  :: CtFlavour
    
    5438 5438
            , ei_loc      :: CtLoc
    
    5439
    -       , ei_m_reason :: Maybe CtIrredReason  -- if this ErrorItem was made from a
    
    5439
    +       , ei_m_reason :: Maybe CtIrredReason  -- If this ErrorItem was made from a
    
    5440 5440
                                                  -- CtIrred, this stores the reason
    
    5441 5441
            , ei_suppress :: Bool    -- Suppress because of
    
    5442 5442
                                     -- Note [Wanteds rewrite Wanteds: rewriter-sets]