summaryrefslogtreecommitdiff
path: root/compiler/typecheck/TcTyDecls.hs
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2016-05-25 00:09:34 +0200
committerAlan Zimmerman <alan.zimm@gmail.com>2016-06-06 21:52:49 +0200
commita13cb27960f9bdb0bc9eececf9159f034f113481 (patch)
tree1f6d154698f022b76042b1b796ca0ed959a2b201 /compiler/typecheck/TcTyDecls.hs
parent1937ef1c506b538f0f93cd290fa4a42fc85ab769 (diff)
downloadhaskell-a13cb27960f9bdb0bc9eececf9159f034f113481.tar.gz
Merge MatchFixity and HsMatchContext
Summary: MatchFixity was introduced to facilitate use of API Annotations. HsMatchContext does the same thing with more detail, but is chased through all over the place to provide context when processing a Match. Since we already have MatchFixity in the Match, it may as well provide the full context. updates submodule haddock Test Plan: ./validate Reviewers: austin, goldfire, bgamari Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2271 GHC Trac Issues: #12105 (cherry picked from commit 306ecad591951521ac3f5888ca8be85bf749d271)
Diffstat (limited to 'compiler/typecheck/TcTyDecls.hs')
-rw-r--r--compiler/typecheck/TcTyDecls.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/typecheck/TcTyDecls.hs b/compiler/typecheck/TcTyDecls.hs
index 8c91b4897d..7529f15001 100644
--- a/compiler/typecheck/TcTyDecls.hs
+++ b/compiler/typecheck/TcTyDecls.hs
@@ -974,9 +974,11 @@ mkOneRecordSelector all_cons idDetails fl
-- where cons_w_field = [C2,C7]
sel_bind = mkTopFunBind Generated sel_lname alts
where
- alts | is_naughty = [mkSimpleMatch [] unit_rhs]
+ alts | is_naughty = [mkSimpleMatch (FunRhs sel_lname Prefix)
+ [] unit_rhs]
| otherwise = map mk_match cons_w_field ++ deflt
- mk_match con = mkSimpleMatch [L loc (mk_sel_pat con)]
+ mk_match con = mkSimpleMatch (FunRhs sel_lname Prefix)
+ [L loc (mk_sel_pat con)]
(L loc (HsVar (L loc field_var)))
mk_sel_pat con = ConPatIn (L loc (getName con)) (RecCon rec_fields)
rec_fields = HsRecFields { rec_flds = [rec_field], rec_dotdot = Nothing }
@@ -992,7 +994,8 @@ mkOneRecordSelector all_cons idDetails fl
-- We do this explicitly so that we get a nice error message that
-- mentions this particular record selector
deflt | all dealt_with all_cons = []
- | otherwise = [mkSimpleMatch [L loc (WildPat placeHolderType)]
+ | otherwise = [mkSimpleMatch CaseAlt
+ [L loc (WildPat placeHolderType)]
(mkHsApp (L loc (HsVar
(L loc (getName rEC_SEL_ERROR_ID))))
(L loc (HsLit msg_lit)))]