[commit: ghc] ghc-7.6: Wrap a bracket quotation in a coercion that makes it have the right type (da26f6c)

Ian Lynagh <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : ghc-7.6

http://hackage.haskell.org/trac/ghc/changeset/da26f6c38c22158f698ec75d910ebe4a61923d25

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

commit da26f6c38c22158f698ec75d910ebe4a61923d25
Author: Simon Peyton Jones <[email protected]>
Date:   Mon Oct 15 15:07:16 2012 +0100

    Wrap a bracket quotation in a coercion that makes it have the right type
    
    This is the right fix to Trac #7276 (part 2), which makes the
    interaction with -fdefer-type-errors and TH work properly.

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

 compiler/typecheck/TcSplice.lhs |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/compiler/typecheck/TcSplice.lhs b/compiler/typecheck/TcSplice.lhs
index 4f3731a..21d0a1d 100644
--- a/compiler/typecheck/TcSplice.lhs
+++ b/compiler/typecheck/TcSplice.lhs
@@ -349,22 +349,22 @@ tcBracket brack res_ty
           -- We build a single implication constraint with a BracketSkol;
           -- that in turn tells simplifyCheck to report only definite
           -- errors
-       ; (_,lie) <- captureConstraints $
-                    newImplication BracketSkol [] [] $
-                    setStage brack_stage $
-                    do { meta_ty <- tc_bracket cur_stage brack
-                       ; unifyType meta_ty res_ty }
+       ; ((_binds1, meta_ty), lie) <- captureConstraints $
+                          newImplication BracketSkol [] [] $
+                          setStage brack_stage $
+                          tc_bracket cur_stage brack
 
           -- It's best to simplify the constraint now, even though in
           -- principle some later unification might be useful for it,
           -- because we don't want these essentially-junk TH implication
           -- contraints floating around nested inside other constraints
           -- See for example Trac #4949
-       ; _ <- simplifyTop lie
+       ; _binds2 <- simplifyTop lie
 
         -- Return the original expression, not the type-decorated one
        ; pendings <- readMutVar pending_splices
-       ; return (noLoc (HsBracketOut brack pendings)) }
+       ; co <- unifyType meta_ty res_ty
+       ; return (noLoc (mkHsWrapCo co (HsBracketOut brack pendings))) }
 
 tc_bracket :: ThStage -> HsBracket Name -> TcM TcType
 tc_bracket outer_stage br@(VarBr _ name)     -- Note [Quoting names]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.