[GHC] #15290: QuantifiedConstraints: panic "addTcEvBind NoEvBindsVar"

GHC ghc-devs at haskell.org
Mon Jun 25 15:07:22 UTC 2018


#15290: QuantifiedConstraints: panic "addTcEvBind NoEvBindsVar"
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:
                                     |  QuantifiedConstraints
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:  quantified-
                                     |  constraints/T15290, T15290a
      Blocked By:                    |             Blocking:  9123, 14883
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Thanks for putting this in the right place.  I think your patch should
 work now; and I tried this which seems even better
 {{{
 diff --git a/compiler/typecheck/TcGenDeriv.hs
 b/compiler/typecheck/TcGenDeriv.hs
 index b944520..736eb14 100644
 --- a/compiler/typecheck/TcGenDeriv.hs
 +++ b/compiler/typecheck/TcGenDeriv.hs
 @@ -1668,13 +1668,12 @@ gen_Newtype_binds loc cls inst_tvs inst_tys rhs_ty
                                            [] rhs_expr]
        where
          Pair from_ty to_ty = mkCoerceClassMethEqn cls inst_tvs inst_tys
 rhs_ty meth_id
 -
          meth_RDR = getRdrName meth_id
 +        (_, _, from_tau) = tcSplitSigmaTy from_ty

          rhs_expr = nlHsVar (getRdrName coerceId)
 -                                      `nlHsAppType` from_ty
 -                                      `nlHsAppType` to_ty
 -                                      `nlHsApp`     nlHsVar meth_RDR
 +                   `nlHsApp` (nlHsVar meth_RDR `nlExprWithTySig`
 from_tau)
 +                   `nlExprWithTySig` to_ty

      mk_atf_inst :: TyCon -> TcM FamInst
      mk_atf_inst fam_tc = do
 @@ -1703,11 +1702,6 @@ gen_Newtype_binds loc cls inst_tvs inst_tys rhs_ty
          rep_cvs'    = toposortTyVars rep_cvs
          pp_lhs      = ppr (mkTyConApp fam_tc rep_lhs_tys)

 -nlHsAppType :: LHsExpr GhcPs -> Type -> LHsExpr GhcPs
 -nlHsAppType e s = noLoc (HsAppType hs_ty e)
 -  where
 -    hs_ty = mkHsWildCardBndrs $ nlHsParTy (typeToLHsType s)
 -
  nlExprWithTySig :: LHsExpr GhcPs -> Type -> LHsExpr GhcPs
  nlExprWithTySig e s = noLoc $ ExprWithTySig hs_ty
                              $ parenthesizeHsExpr sigPrec e
 }}}
 I like this because it feels more uniform: two type signatures rather that
 one type signature and two type applications.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15290#comment:26>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list