From 6350eb1126e29b93829de688623c91b772f6d9eb Mon Sep 17 00:00:00 2001 From: Thomas Miedema Date: Thu, 25 Feb 2016 15:51:38 +0100 Subject: Handle multiline named haddock comments properly Fixes #10398 in a different way, thereby also fixing #11579. I inverted the logic of the Bool argument to "worker", to hopefully make it more self-explanatory. Reviewers: austin, hvr, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D1935 --- testsuite/tests/ghc-api/T11579.hs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 testsuite/tests/ghc-api/T11579.hs (limited to 'testsuite/tests/ghc-api/T11579.hs') diff --git a/testsuite/tests/ghc-api/T11579.hs b/testsuite/tests/ghc-api/T11579.hs new file mode 100644 index 0000000000..3294f999f2 --- /dev/null +++ b/testsuite/tests/ghc-api/T11579.hs @@ -0,0 +1,26 @@ +import System.Environment +import DynFlags +import FastString +import GHC +import StringBuffer +import Lexer +import SrcLoc + +main :: IO () +main = do + [libdir] <- getArgs + + let stringBuffer = stringToStringBuffer "-- $bar some\n-- named chunk" + loc = mkRealSrcLoc (mkFastString "Foo.hs") 1 1 + + token <- runGhc (Just libdir) $ do + dflags <- getSessionDynFlags + let pstate = mkPState (dflags `gopt_set` Opt_Haddock) stringBuffer loc + case unP (lexer False return) pstate of + POk _ token -> return (unLoc token) + _ -> error "No token" + + -- #11579 + -- Expected: "ITdocCommentNamed "bar some\n named chunk" + -- Actual (with ghc-8.0.1-rc2): "ITdocCommentNamed "bar some" + print token -- cgit v1.2.1