Simon Peyton Jones pushed to branch wip/T26115 at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • compiler/GHC/Tc/Deriv/Utils.hs
    ... ... @@ -55,16 +55,18 @@ import GHC.Unit.Module (getModule)
    55 55
     import GHC.Unit.Module.Warnings
    
    56 56
     import GHC.Unit.Module.ModIface (mi_fix)
    
    57 57
     
    
    58
    -import GHC.Types.Fixity.Env (lookupFixity)
    
    59 58
     import GHC.Iface.Load   (loadInterfaceForName)
    
    59
    +
    
    60
    +import GHC.Types.Fixity.Env (lookupFixity)
    
    60 61
     import GHC.Types.Name
    
    61 62
     import GHC.Types.SrcLoc
    
    62
    -import GHC.Utils.Misc
    
    63 63
     import GHC.Types.Var.Set
    
    64
    +import GHC.Types.Id( idName )
    
    64 65
     
    
    65 66
     import GHC.Builtin.Names
    
    66 67
     import GHC.Builtin.Names.TH (liftClassKey)
    
    67 68
     
    
    69
    +import GHC.Utils.Misc
    
    68 70
     import GHC.Utils.Outputable
    
    69 71
     import GHC.Utils.Panic
    
    70 72
     import GHC.Utils.Error
    
    ... ... @@ -714,7 +716,13 @@ emitPredSpecConstraints _ (SimplePredSpec { sps_pred = wanted_pred
    714 716
         -- but here when we are trying to infer the context for an instance decl, we
    
    715 717
         -- need that half-solved implication.  See deriving/should_compile/T20815
    
    716 718
         -- and Note [Inferred contexts from method constraints]
    
    717
    -  = do { let skol_info_anon = DerivSkol wanted_pred
    
    719
    +  = do { let skol_info_anon
    
    720
    +               = case orig of
    
    721
    +                   DerivOriginCoerce meth _ _ _ -> MethSkol (idName meth) False
    
    722
    +                   _ -> pprPanic "emitPredSpecConstraints" (ppr orig $$ ppr wanted_pred)
    
    723
    +                        -- We only get a polymorphic wanted_pred from DerivOriginCoerce
    
    724
    +                        -- This is a bit messy, but arises from the fact that SimplePredSpe
    
    725
    +                        -- is not really simple!
    
    718 726
            ; skol_info <- mkSkolemInfo skol_info_anon
    
    719 727
            ; (_wrapper, tv_prs, givens, wanted_rho) <- topSkolemise skol_info wanted_pred
    
    720 728
              -- _wrapper: we ignore the evidence from all these constraints