[commit: ghc] master: Wrap a bracket quotation in a coercion that makes it have the right type (0b2a6a0)

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

On branch  : master

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

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

commit 0b2a6a0580c34e4fcb77a67719d77b358bb4d69d
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 c5f0af3..7c064b8 100644
--- a/compiler/typecheck/TcSplice.lhs
+++ b/compiler/typecheck/TcSplice.lhs
@@ -350,22 +350,22 @@ tcBracket brack res_ty
           -- We build a single implication constraint with a BracketSkol;
           -- that in turn tells simplifyTop 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.