[commit: ghc] master: Parser: allow empty multi-line deprecation warnings (8262c95)

git at git.haskell.org git at git.haskell.org
Sat Nov 7 23:54:24 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8262c954ac3084f0dfcb6d5fa6e6172afd22eae7/ghc

>---------------------------------------------------------------

commit 8262c954ac3084f0dfcb6d5fa6e6172afd22eae7
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Sun Nov 8 00:20:15 2015 +0100

    Parser: allow empty multi-line deprecation warnings
    
    This should work,
    
        {-# DEPRECATED someFunction [] #-}
    
    Test Plan: parser/should_compile/T3303
    
    Reviewers: bgamari, austin
    
    Reviewed By: austin
    
    Subscribers: mpickering
    
    Differential Revision: https://phabricator.haskell.org/D1433
    
    GHC Trac Issues: #11044


>---------------------------------------------------------------

8262c954ac3084f0dfcb6d5fa6e6172afd22eae7
 compiler/parser/Parser.y                           | 1 +
 testsuite/tests/parser/should_compile/T3303.hs     | 2 ++
 testsuite/tests/parser/should_compile/T3303.stderr | 5 ++++-
 testsuite/tests/parser/should_compile/T3303A.hs    | 5 +++++
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index 62d1114..d72f50d 100644
--- a/compiler/parser/Parser.y
+++ b/compiler/parser/Parser.y
@@ -1422,6 +1422,7 @@ stringlist :: { Located (OrdList (Located StringLiteral)) }
                                return (sLL $1 $> (unLoc $1 `snocOL`
                                                   (L (gl $3) (getStringLiteral $3)))) }
     | STRING                { sLL $1 $> (unitOL (L (gl $1) (getStringLiteral $1))) }
+    | {- empty -}           { noLoc nilOL }
 
 -----------------------------------------------------------------------------
 -- Annotations
diff --git a/testsuite/tests/parser/should_compile/T3303.hs b/testsuite/tests/parser/should_compile/T3303.hs
index 08de52e..7d9bfbd 100644
--- a/testsuite/tests/parser/should_compile/T3303.hs
+++ b/testsuite/tests/parser/should_compile/T3303.hs
@@ -6,3 +6,5 @@ import T3303A
 bar :: Int
 bar = foo
 
+bar2 :: Int
+bar2 = foo2
diff --git a/testsuite/tests/parser/should_compile/T3303.stderr b/testsuite/tests/parser/should_compile/T3303.stderr
index df227f4..a8d2f63 100644
--- a/testsuite/tests/parser/should_compile/T3303.stderr
+++ b/testsuite/tests/parser/should_compile/T3303.stderr
@@ -1,6 +1,9 @@
 
-T3303.hs:7:7: Warning:
+T3303.hs:7:7: warning:
     In the use of ‘foo’ (imported from T3303A):
     Deprecated: "This is a multi-line
                  deprecation message
                  for foo"
+
+T3303.hs:10:8: warning:
+    In the use of ‘foo2’ (imported from T3303A): Deprecated: ""
diff --git a/testsuite/tests/parser/should_compile/T3303A.hs b/testsuite/tests/parser/should_compile/T3303A.hs
index daa4bfb..07a2eb8 100644
--- a/testsuite/tests/parser/should_compile/T3303A.hs
+++ b/testsuite/tests/parser/should_compile/T3303A.hs
@@ -8,3 +8,8 @@ module T3303A where
 foo :: Int
 foo = 4
 
+-- Empty list should work too (#11044).
+{-# DEPRECATED foo2 [] #-}
+
+foo2 :: Int
+foo2 = 4



More information about the ghc-commits mailing list