[commit: ghc] master: Preserve synonyms if possible (leads to better error messages) through flattening. (0b42a7d)

dimitris at microsoft.com dimitris at microsoft.com
Thu Jul 19 14:38:33 CEST 2012


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/0b42a7dc92e9c50483ea652d7421b43217902296

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

commit 0b42a7dc92e9c50483ea652d7421b43217902296
Author: Dimitrios Vytiniotis <dimitris at microsoft.com>
Date:   Thu Jul 19 11:26:45 2012 +0200

    Preserve synonyms if possible (leads to better error messages) through flattening.

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

 compiler/typecheck/TcCanonical.lhs |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/compiler/typecheck/TcCanonical.lhs b/compiler/typecheck/TcCanonical.lhs
index 7f1288c..b013e25 100644
--- a/compiler/typecheck/TcCanonical.lhs
+++ b/compiler/typecheck/TcCanonical.lhs
@@ -506,7 +506,8 @@ flatten :: SubGoalDepth -- Depth
 flatten d f ctxt ty 
   | Just ty' <- tcView ty
   = do { (xi, co) <- flatten d f ctxt ty'
-       ; return (xi,co) } 
+       ; if eqType xi ty then return (ty,co) else return (xi,co) } 
+       -- Small tweak for better error messages 
 
 flatten _ _ _ xi@(LitTy {}) = return (xi, mkTcReflCo xi)
 





More information about the Cvs-ghc mailing list