Commit 33950aa6 authored by eir@cis.upenn.edu's avatar eir@cis.upenn.edu
Browse files

Tiny refactoring in TcUnify

parent 072191fe
...@@ -677,8 +677,10 @@ tc_sub_type_ds eq_orig inst_orig ctxt ty_actual ty_expected ...@@ -677,8 +677,10 @@ tc_sub_type_ds eq_orig inst_orig ctxt ty_actual ty_expected
= inst_and_unify = inst_and_unify
-- It's still possible that ty_actual has nested foralls. Instantiate -- It's still possible that ty_actual has nested foralls. Instantiate
-- these, as there's no way unification will succeed with them in. -- these, as there's no way unification will succeed with them in.
-- See typecheck/should_compiler/T11350 for an example of when this -- See typecheck/should_compile/T11305 for an example of when this
-- is important. -- 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 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 ...@@ -688,15 +690,10 @@ tc_sub_type_ds eq_orig inst_orig ctxt ty_actual ty_expected
-- instantiation. If we *have* recurred through -- instantiation. If we *have* recurred through
-- an arrow, it's better not to update. -- an arrow, it's better not to update.
; let eq_orig' = case eq_orig of ; let eq_orig' = case eq_orig of
TypeEqOrigin { uo_actual = orig_ty_actual TypeEqOrigin { uo_actual = orig_ty_actual }
, uo_expected = orig_ty_expected
, uo_thing = thing }
| orig_ty_actual `tcEqType` ty_actual | orig_ty_actual `tcEqType` ty_actual
, not (isIdHsWrapper wrap) , not (isIdHsWrapper wrap)
-> TypeEqOrigin -> eq_orig { uo_actual = rho_a }
{ uo_actual = rho_a
, uo_expected = orig_ty_expected
, uo_thing = thing }
_ -> eq_orig _ -> eq_orig
; cow <- uType eq_orig' TypeLevel rho_a ty_expected ; cow <- uType eq_orig' TypeLevel rho_a ty_expected
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment