diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-11-28 11:33:37 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2017-12-07 14:40:35 +0000 |
commit | fa29df02a1b0b926afb2525a258172dcbf0ea460 (patch) | |
tree | 594244e6f84a99a36acfd962eeb62b4a35f42726 /testsuite/tests/parser | |
parent | 5f332e1dab000e1f79c127d441f618280d14d2bd (diff) | |
download | haskell-fa29df02a1b0b926afb2525a258172dcbf0ea460.tar.gz |
Refactor ConDecl: Trac #14529
This patch refactors HsDecls.ConDecl. Specifically
* ConDeclGADT was horrible, with all the information hidden
inside con_res_ty. Now it's kept separate, as it should be.
* ConDeclH98: use [LHsTyVarBndr] instead of LHsQTyVars for the
existentials. There is no implicit binding here.
* Add a field con_forall to both ConDeclGADT and ConDeclH98
which says if there is an explicit user-written forall.
* Field renamings in ConDecl
con_cxt to con_mb_cxt
con_details to con_args
There is an accompanying submodule update to Haddock.
Also the following change turned out to remove a lot of clutter:
* add a smart constructor for HsAppsTy, namely mkHsAppsTy,
and use it consistently. This avoids a lot of painful pattern
matching for the common singleton case.
Two api-annotation tests (T10278, and T10399) are broken, hence marking
them as expect_broken(14529). Alan is going to fix them, probably by
changing the con_forall field to
con_forall :: Maybe SrcSpan
instead of Bool
Diffstat (limited to 'testsuite/tests/parser')
3 files changed, 91 insertions, 111 deletions
diff --git a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr index 46ab21412e..127f28ac4e 100644 --- a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr +++ b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr @@ -30,10 +30,9 @@ ({ DumpParsedAst.hs:5:14-17 } (Unqual {OccName: Zero})) + (False) + [] (Nothing) - (Just - ({ <no location info> } - [])) (PrefixCon []) (Nothing))) @@ -42,10 +41,9 @@ ({ DumpParsedAst.hs:5:21-24 } (Unqual {OccName: Succ})) + (False) + [] (Nothing) - (Just - ({ <no location info> } - [])) (PrefixCon [({ DumpParsedAst.hs:5:26-30 } (HsTyVar @@ -144,15 +142,11 @@ []))] (Prefix) ({ DumpParsedAst.hs:9:21-24 } - (HsAppsTy - [({ DumpParsedAst.hs:9:21-24 } - (HsAppPrefix - ({ DumpParsedAst.hs:9:21-24 } - (HsTyVar - (NotPromoted) - ({ DumpParsedAst.hs:9:21-24 } - (Unqual - {OccName: Zero}))))))]))) + (HsTyVar + (NotPromoted) + ({ DumpParsedAst.hs:9:21-24 } + (Unqual + {OccName: Zero}))))) (PlaceHolder)))])) ({ DumpParsedAst.hs:7:13-18 } (Unqual @@ -165,35 +159,23 @@ (Unqual {OccName: as})) ({ DumpParsedAst.hs:7:27-29 } - (HsAppsTy - [({ DumpParsedAst.hs:7:27-29 } - (HsAppPrefix - ({ DumpParsedAst.hs:7:27-29 } - (HsListTy - ({ DumpParsedAst.hs:7:28 } - (HsAppsTy - [({ DumpParsedAst.hs:7:28 } - (HsAppPrefix - ({ DumpParsedAst.hs:7:28 } - (HsTyVar - (NotPromoted) - ({ DumpParsedAst.hs:7:28 } - (Unqual - {OccName: k}))))))]))))))]))))] + (HsListTy + ({ DumpParsedAst.hs:7:28 } + (HsTyVar + (NotPromoted) + ({ DumpParsedAst.hs:7:28 } + (Unqual + {OccName: k}))))))))] (PlaceHolder)) (Prefix) ({ DumpParsedAst.hs:7:32-39 } (KindSig ({ DumpParsedAst.hs:7:35-39 } - (HsAppsTy - [({ DumpParsedAst.hs:7:35-39 } - (HsAppPrefix - ({ DumpParsedAst.hs:7:35-39 } - (HsTyVar - (NotPromoted) - ({ DumpParsedAst.hs:7:35-39 } - (Unqual - {OccName: Peano}))))))])))) + (HsTyVar + (NotPromoted) + ({ DumpParsedAst.hs:7:35-39 } + (Unqual + {OccName: Peano})))))) (Nothing))))) ,({ DumpParsedAst.hs:11:1-23 } (ValD diff --git a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr index c7daf90ff0..3ddb5ed462 100644 --- a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr +++ b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr @@ -70,10 +70,9 @@ (ConDeclH98 ({ DumpRenamedAst.hs:6:14-17 } {Name: DumpRenamedAst.Zero}) + (False) + [] (Nothing) - (Just - ({ <no location info> } - [])) (PrefixCon []) (Nothing))) @@ -81,10 +80,9 @@ (ConDeclH98 ({ DumpRenamedAst.hs:6:21-24 } {Name: DumpRenamedAst.Succ}) + (False) + [] (Nothing) - (Just - ({ <no location info> } - [])) (PrefixCon [({ DumpRenamedAst.hs:6:26-30 } (HsTyVar @@ -293,65 +291,68 @@ (ConDeclGADT [({ DumpRenamedAst.hs:16:3-5 } {Name: DumpRenamedAst.Nat})] - (HsIB + (False) + (HsQTvs [{Name: f} ,{Name: g}] - ({ DumpRenamedAst.hs:16:10-45 } - (HsFunTy - ({ DumpRenamedAst.hs:16:10-34 } - (HsParTy - ({ DumpRenamedAst.hs:16:11-33 } - (HsForAllTy - [({ DumpRenamedAst.hs:16:18-19 } - (UserTyVar - ({ DumpRenamedAst.hs:16:18-19 } - {Name: xx})))] - ({ DumpRenamedAst.hs:16:22-33 } - (HsFunTy - ({ DumpRenamedAst.hs:16:22-25 } - (HsAppTy - ({ DumpRenamedAst.hs:16:22 } - (HsTyVar - (NotPromoted) - ({ DumpRenamedAst.hs:16:22 } - {Name: f}))) - ({ DumpRenamedAst.hs:16:24-25 } - (HsTyVar - (NotPromoted) - ({ DumpRenamedAst.hs:16:24-25 } - {Name: xx}))))) - ({ DumpRenamedAst.hs:16:30-33 } - (HsAppTy - ({ DumpRenamedAst.hs:16:30 } - (HsTyVar - (NotPromoted) - ({ DumpRenamedAst.hs:16:30 } - {Name: g}))) - ({ DumpRenamedAst.hs:16:32-33 } - (HsTyVar - (NotPromoted) - ({ DumpRenamedAst.hs:16:32-33 } - {Name: xx}))))))))))) - ({ DumpRenamedAst.hs:16:39-45 } - (HsAppTy - ({ DumpRenamedAst.hs:16:39-43 } - (HsAppTy - ({ DumpRenamedAst.hs:16:39-41 } - (HsTyVar - (NotPromoted) - ({ DumpRenamedAst.hs:16:39-41 } - {Name: DumpRenamedAst.Nat}))) - ({ DumpRenamedAst.hs:16:43 } - (HsTyVar - (NotPromoted) - ({ DumpRenamedAst.hs:16:43 } - {Name: f}))))) - ({ DumpRenamedAst.hs:16:45 } - (HsTyVar - (NotPromoted) - ({ DumpRenamedAst.hs:16:45 } - {Name: g}))))))) - (True)) + [] + {NameSet: + []}) + (Nothing) + (PrefixCon + [({ DumpRenamedAst.hs:16:10-34 } + (HsParTy + ({ DumpRenamedAst.hs:16:11-33 } + (HsForAllTy + [({ DumpRenamedAst.hs:16:18-19 } + (UserTyVar + ({ DumpRenamedAst.hs:16:18-19 } + {Name: xx})))] + ({ DumpRenamedAst.hs:16:22-33 } + (HsFunTy + ({ DumpRenamedAst.hs:16:22-25 } + (HsAppTy + ({ DumpRenamedAst.hs:16:22 } + (HsTyVar + (NotPromoted) + ({ DumpRenamedAst.hs:16:22 } + {Name: f}))) + ({ DumpRenamedAst.hs:16:24-25 } + (HsTyVar + (NotPromoted) + ({ DumpRenamedAst.hs:16:24-25 } + {Name: xx}))))) + ({ DumpRenamedAst.hs:16:30-33 } + (HsAppTy + ({ DumpRenamedAst.hs:16:30 } + (HsTyVar + (NotPromoted) + ({ DumpRenamedAst.hs:16:30 } + {Name: g}))) + ({ DumpRenamedAst.hs:16:32-33 } + (HsTyVar + (NotPromoted) + ({ DumpRenamedAst.hs:16:32-33 } + {Name: xx})))))))))))]) + ({ DumpRenamedAst.hs:16:39-45 } + (HsAppTy + ({ DumpRenamedAst.hs:16:39-43 } + (HsAppTy + ({ DumpRenamedAst.hs:16:39-41 } + (HsTyVar + (NotPromoted) + ({ DumpRenamedAst.hs:16:39-41 } + {Name: DumpRenamedAst.Nat}))) + ({ DumpRenamedAst.hs:16:43 } + (HsTyVar + (NotPromoted) + ({ DumpRenamedAst.hs:16:43 } + {Name: f}))))) + ({ DumpRenamedAst.hs:16:45 } + (HsTyVar + (NotPromoted) + ({ DumpRenamedAst.hs:16:45 } + {Name: g}))))) (Nothing)))] ({ <no location info> } []))) diff --git a/testsuite/tests/parser/should_compile/T14189.stderr b/testsuite/tests/parser/should_compile/T14189.stderr index 53e4a6f941..439c5ff135 100644 --- a/testsuite/tests/parser/should_compile/T14189.stderr +++ b/testsuite/tests/parser/should_compile/T14189.stderr @@ -29,10 +29,9 @@ (ConDeclH98 ({ T14189.hs:6:15-16 } {Name: T14189.MT}) + (False) + [] (Nothing) - (Just - ({ <no location info> } - [])) (PrefixCon [({ T14189.hs:6:18-20 } (HsTyVar @@ -44,10 +43,9 @@ (ConDeclH98 ({ T14189.hs:6:24-25 } {Name: T14189.NT}) + (False) + [] (Nothing) - (Just - ({ <no location info> } - [])) (PrefixCon []) (Nothing))) @@ -55,10 +53,9 @@ (ConDeclH98 ({ T14189.hs:6:29 } {Name: T14189.F}) + (False) + [] (Nothing) - (Just - ({ <no location info> } - [])) (RecCon ({ T14189.hs:6:31-42 } [({ T14189.hs:6:33-40 } |