[commit: ghc] master: Tiny refactoring in TcUnify (33950aa)

git at git.haskell.org git at git.haskell.org
Fri Jan 15 20:44:00 UTC 2016


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/33950aa6cfa9ba6866c81254c960de4def062fd2/ghc

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

commit 33950aa6cfa9ba6866c81254c960de4def062fd2
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date:   Mon Jan 11 21:28:24 2016 -0500

    Tiny refactoring in TcUnify


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

33950aa6cfa9ba6866c81254c960de4def062fd2
 compiler/typecheck/TcUnify.hs | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/compiler/typecheck/TcUnify.hs b/compiler/typecheck/TcUnify.hs
index 908b692..33525be 100644
--- a/compiler/typecheck/TcUnify.hs
+++ b/compiler/typecheck/TcUnify.hs
@@ -677,8 +677,10 @@ tc_sub_type_ds eq_orig inst_orig ctxt ty_actual ty_expected
       = inst_and_unify
          -- It's still possible that ty_actual has nested foralls. Instantiate
          -- these, as there's no way unification will succeed with them in.
-         -- See typecheck/should_compiler/T11350 for an example of when this
-         -- is important.
+         -- See typecheck/should_compile/T11305 for an example of when this
+         -- is important. The problem is that we're checking something like
+         --  a -> forall b. b -> b     <=   alpha beta gamma
+         -- where we end up with alpha := (->)
 
     inst_and_unify = do { (wrap, rho_a) <- deeplyInstantiate inst_orig ty_actual
 
@@ -688,15 +690,10 @@ tc_sub_type_ds eq_orig inst_orig ctxt ty_actual ty_expected
                            -- instantiation. If we *have* recurred through
                            -- an arrow, it's better not to update.
                         ; let eq_orig' = case eq_orig of
-                                TypeEqOrigin { uo_actual   = orig_ty_actual
-                                             , uo_expected = orig_ty_expected
-                                             , uo_thing    = thing }
+                                TypeEqOrigin { uo_actual   = orig_ty_actual }
                                   |  orig_ty_actual `tcEqType` ty_actual
                                   ,  not (isIdHsWrapper wrap)
-                                  -> TypeEqOrigin
-                                       { uo_actual = rho_a
-                                       , uo_expected = orig_ty_expected
-                                       , uo_thing    = thing }
+                                  -> eq_orig { uo_actual = rho_a }
                                 _ -> eq_orig
 
                         ; cow <- uType eq_orig' TypeLevel rho_a ty_expected



More information about the ghc-commits mailing list