summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonpj@microsoft.com <unknown>2006-12-11 16:05:57 +0000
committersimonpj@microsoft.com <unknown>2006-12-11 16:05:57 +0000
commit85de95cd55d5dcda29630b665b50c7575df6dddd (patch)
tree5677e5df88515da23db0e52f6f64df85c7c78edd
parent536ef736dfc1568670d44072abfb4f16c84bcdb8 (diff)
downloadhaskell-85de95cd55d5dcda29630b665b50c7575df6dddd.tar.gz
Improve origin of constraints in subsumption checking
-rw-r--r--compiler/typecheck/TcUnify.lhs8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/typecheck/TcUnify.lhs b/compiler/typecheck/TcUnify.lhs
index 169cf7b5c4..1868ad0d12 100644
--- a/compiler/typecheck/TcUnify.lhs
+++ b/compiler/typecheck/TcUnify.lhs
@@ -682,7 +682,13 @@ tc_sub1 sub_ctxt act_sty actual_ty exp_ib exp_sty expected_ty
; co_fn2 <- tc_sub sub_ctxt tau' tau' exp_ib exp_sty expected_ty
-- Deal with the dictionaries
- ; co_fn1 <- instCall InstSigOrigin inst_tys (substTheta subst' theta)
+ -- The origin gives a helpful origin when we have
+ -- a function with type f :: Int -> forall a. Num a => ...
+ -- This way the (Num a) dictionary gets an OccurrenceOf f origin
+ ; let orig = case sub_ctxt of
+ SubFun n -> OccurrenceOf n
+ other -> InstSigOrigin -- Unhelpful
+ ; co_fn1 <- instCall orig inst_tys (substTheta subst' theta)
; return (co_fn2 <.> co_fn1) }
-----------------------------------