summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/parser/Parser.y9
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/haddockA038.stderr4
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.hs29
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.stderr11
4 files changed, 51 insertions, 2 deletions
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index 6fc233ed42..25edb3e591 100644
--- a/compiler/parser/Parser.y
+++ b/compiler/parser/Parser.y
@@ -1890,6 +1890,7 @@ type :: { LHsType GhcPs }
typedoc :: { LHsType GhcPs }
: btype { $1 }
| btype docprev { sLL $1 $> $ HsDocTy noExt $1 $2 }
+ | docnext btype { sLL $1 $> $ HsDocTy noExt $2 $1 }
| btype '->' ctypedoc {% ams $1 [mu AnnRarrow $2] -- See note [GADT decl discards annotations]
>> ams (sLL $1 $> $ HsFunTy noExt $1 $3)
[mu AnnRarrow $2] }
@@ -1899,6 +1900,14 @@ typedoc :: { LHsType GhcPs }
(HsDocTy noExt $1 $2))
$4)
[mu AnnRarrow $3] }
+ | docnext btype '->' ctypedoc {% ams $2 [mu AnnRarrow $3] -- See note [GADT decl discards annotations]
+ >> ams (sLL $1 $> $
+ HsFunTy noExt (L (comb2 $1 $2)
+ (HsDocTy noExt $2 $1))
+ $4)
+ [mu AnnRarrow $3] }
+
+
-- See Note [Parsing ~]
btype :: { LHsType GhcPs }
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA038.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA038.stderr
index 94318efe2b..3021fa7195 100644
--- a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA038.stderr
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA038.stderr
@@ -3,5 +3,5 @@
module UnamedConstructorStrictFields where
data A = A
data B = B
-data Foo = MkFoo {-# UNPACK #-} !A Unpacked strict field B
-data Bar = {-# UNPACK #-} !A Unpacked strict field :%% B
+data Foo = MkFoo {-# UNPACK #-} !A " Unpacked strict field" B
+data Bar = {-# UNPACK #-} !A " Unpacked strict field" :%% B
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.hs b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.hs
new file mode 100644
index 0000000000..79d23e9ec1
--- /dev/null
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.hs
@@ -0,0 +1,29 @@
+module CommentsBeforeArguments where
+
+data A = A
+data B = B
+
+f1 :: {-| Comment before -}
+ () ->
+
+ ()
+ {-^ Comment after -} ->
+
+ ()
+ {-^ Result after -}
+f1 _ _ = ()
+
+
+f2 :: {-| Comment before -}
+ () ->
+
+ ()
+ {-^ Comment after -} ->
+
+ {-| Result after -}
+ ()
+f2 _ _ = ()
+
+
+
+
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.stderr
new file mode 100644
index 0000000000..0c12f5c62f
--- /dev/null
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.stderr
@@ -0,0 +1,11 @@
+
+==================== Parser ====================
+module CommentsBeforeArguments where
+f1 ::
+ () Comment before -> () Comment after -> () Result after
+f1 _ _ = ()
+f2 ::
+ () Comment before -> () Comment after -> () Result after
+f2 _ _ = ()
+
+