[commit: ghc] wip/rae-new-coercible: Print DerivOriginCoerce errors with context (4be1115)

git at git.haskell.org git at git.haskell.org
Tue Dec 2 20:43:59 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/rae-new-coercible
Link       : http://ghc.haskell.org/trac/ghc/changeset/4be1115933460d7c97e98bf83e49341ffabeda65/ghc

>---------------------------------------------------------------

commit 4be1115933460d7c97e98bf83e49341ffabeda65
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date:   Mon Dec 1 14:58:48 2014 -0500

    Print DerivOriginCoerce errors with context


>---------------------------------------------------------------

4be1115933460d7c97e98bf83e49341ffabeda65
 compiler/typecheck/TcErrors.lhs  | 7 ++++---
 compiler/typecheck/TcRnTypes.lhs | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/compiler/typecheck/TcErrors.lhs b/compiler/typecheck/TcErrors.lhs
index 072a736..1d8fedc 100644
--- a/compiler/typecheck/TcErrors.lhs
+++ b/compiler/typecheck/TcErrors.lhs
@@ -708,9 +708,10 @@ mkEqErr1 ctxt ct
                  TypeEqOrigin {} -> snd (mkExpectedActualMsg cty1 cty2 sub_o)
                  _ -> empty
 
-    mk_wanted_extra orig@(FunDepOrigin1 {}) = (Nothing, pprArising orig)
-    mk_wanted_extra orig@(FunDepOrigin2 {}) = (Nothing, pprArising orig)
-    mk_wanted_extra _                       = (Nothing, empty)
+    mk_wanted_extra orig@(FunDepOrigin1 {})     = (Nothing, pprArising orig)
+    mk_wanted_extra orig@(FunDepOrigin2 {})     = (Nothing, pprArising orig)
+    mk_wanted_extra orig@(DerivOriginCoerce {}) = (Nothing, pprArising orig)
+    mk_wanted_extra _                           = (Nothing, empty)
 
 -- | This function tries to reconstruct why a "Coercible ty1 ty2" constraint
 -- is left over.
diff --git a/compiler/typecheck/TcRnTypes.lhs b/compiler/typecheck/TcRnTypes.lhs
index 713829a..136489a 100644
--- a/compiler/typecheck/TcRnTypes.lhs
+++ b/compiler/typecheck/TcRnTypes.lhs
@@ -2002,8 +2002,8 @@ pprCtOrigin (DerivOriginDC dc n)
 
 pprCtOrigin (DerivOriginCoerce meth ty1 ty2)
   = hang (ctoHerald <+> ptext (sLit "the coercion of the method") <+> quotes (ppr meth))
-       2 (sep [ ptext (sLit "from type") <+> quotes (ppr ty1)
-              , ptext (sLit "  to type") <+> quotes (ppr ty2) ])
+       2 (sep [ text "from type" <+> quotes (ppr ty1)
+              , nest 2 $ text "to type" <+> quotes (ppr ty2) ])
 
 pprCtOrigin simple_origin
   = ctoHerald <+> pprCtO simple_origin



More information about the ghc-commits mailing list