summaryrefslogtreecommitdiff
path: root/compiler/typecheck
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/typecheck')
-rw-r--r--compiler/typecheck/TcBinds.hs11
-rw-r--r--compiler/typecheck/TcSimplify.hs2
2 files changed, 10 insertions, 3 deletions
diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs
index dc701d360b..54adc10ffe 100644
--- a/compiler/typecheck/TcBinds.hs
+++ b/compiler/typecheck/TcBinds.hs
@@ -241,7 +241,11 @@ tcCompleteSigs sigs =
mkMatch :: [ConLike] -> TyCon -> CompleteMatch
mkMatch cls ty_con = CompleteMatch {
- completeMatchConLikes = map conLikeName cls,
+ -- foldM is a left-fold and will have accumulated the ConLikes in
+ -- the reverse order. foldrM would accumulate in the correct order,
+ -- but would type-check the last ConLike first, which might also be
+ -- confusing from the user's perspective. Hence reverse here.
+ completeMatchConLikes = reverse (map conLikeName cls),
completeMatchTyCon = tyConName ty_con
}
doOne _ = return Nothing
@@ -287,7 +291,10 @@ tcCompleteSigs sigs =
<+> parens (quotes (ppr tc)
<+> text "resp."
<+> quotes (ppr tc'))
- in mapMaybeM (addLocM doOne) sigs
+ -- For some reason I haven't investigated further, the signatures come in
+ -- backwards wrt. declaration order. So we reverse them here, because it makes
+ -- a difference for incomplete match suggestions.
+ in mapMaybeM (addLocM doOne) (reverse sigs) -- process in declaration order
tcHsBootSigs :: [(RecFlag, LHsBinds GhcRn)] -> [LSig GhcRn] -> TcM [Id]
-- A hs-boot file has only one BindGroup, and it only has type
diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs
index 34bc4a8448..37015b30bc 100644
--- a/compiler/typecheck/TcSimplify.hs
+++ b/compiler/typecheck/TcSimplify.hs
@@ -693,7 +693,7 @@ It does *not* reduce type or data family applications or look through newtypes.
Why is this useful? As one example, when coverage-checking an EmptyCase
expression, it's possible that the type of the scrutinee will only reduce
if some local equalities are solved for. See "Wrinkle: Local equalities"
-in Note [Type normalisation for EmptyCase] in Check.
+in Note [Type normalisation] in Check.
To accomplish its stated goal, tcNormalise first feeds the local constraints
into solveSimpleGivens, then stuffs the argument type in a CHoleCan, and feeds