[GHC] #11579: Bug in parser for named Haddock chunks since GHC 8.0.1-rc1
#11579: Bug in parser for named Haddock chunks since GHC 8.0.1-rc1 -------------------------------------+------------------------------------- Reporter: SimonHengel | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Steps to reproduce: {{{ -- Foo.hs module Foo where -- $bar some -- named chunk }}} {{{ -- Extract.hs module Extract where import Prelude hiding (mod) import Data.Generics import DynFlags import FastString import GHC import GHC.Paths extractDocStrings :: IO [String] extractDocStrings = do extract . pm_parsed_source <$> do runGhc (Just libdir) $ do _ <- getSessionDynFlags >>= setSessionDynFlags . setHaddockMode guessTarget "Foo.hs" Nothing >>= setTargets . return [mod] <- depanal [] False parseModule mod where setHaddockMode :: DynFlags -> DynFlags setHaddockMode dynflags = (gopt_set dynflags Opt_Haddock) extract :: ParsedSource -> [String] extract m = [unpackFS s | HsDocString s <- everything (++) ([] `mkQ` return) m] }}} Expected result: {{{extractDocStrings}}} returns {{{" some\n named chunk"}}} Actual result: it returns {{{" some"}}} instead -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11579> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11579: Bug in parser for named Haddock chunks since GHC 8.0.1-rc1 -------------------------------------+------------------------------------- Reporter: SimonHengel | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by SimonHengel): * version: 7.10.3 => 8.0.1-rc2 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11579#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11579: Bug in parser for named Haddock chunks since GHC 8.0.1-rc1 -------------------------------------+------------------------------------- Reporter: SimonHengel | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by darchon): As I reported on the doctest github issue tracker, https://github.com/sol/doctest/issues/117, named sections using multi-line comments still work, where: {{{ {- $bar some named chunk -} }}} results in: {{{ *Extract> extractDocStrings [" some\n named chunk\n"] }}} So it's only named sections using single-line comments that seem broken. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11579#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11579: Bug in parser for named Haddock chunks since GHC 8.0.1-rc1 -------------------------------------+------------------------------------- Reporter: SimonHengel | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc2 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * priority: normal => high * component: Compiler => Compiler (Parser) * milestone: => 8.0.1 @@ -3,1 +3,1 @@ - {{{ + {{{#!hs @@ -11,1 +11,1 @@ - {{{ + {{{#!hs New description: Steps to reproduce: {{{#!hs -- Foo.hs module Foo where -- $bar some -- named chunk }}} {{{#!hs -- Extract.hs module Extract where import Prelude hiding (mod) import Data.Generics import DynFlags import FastString import GHC import GHC.Paths extractDocStrings :: IO [String] extractDocStrings = do extract . pm_parsed_source <$> do runGhc (Just libdir) $ do _ <- getSessionDynFlags >>= setSessionDynFlags . setHaddockMode guessTarget "Foo.hs" Nothing >>= setTargets . return [mod] <- depanal [] False parseModule mod where setHaddockMode :: DynFlags -> DynFlags setHaddockMode dynflags = (gopt_set dynflags Opt_Haddock) extract :: ParsedSource -> [String] extract m = [unpackFS s | HsDocString s <- everything (++) ([] `mkQ` return) m] }}} Expected result: {{{extractDocStrings}}} returns {{{" some\n named chunk"}}} Actual result: it returns {{{" some"}}} instead -- Comment: Oh dear, this should get fixed. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11579#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11579: Bug in parser for named Haddock chunks since GHC 8.0.1-rc1 -------------------------------------+------------------------------------- Reporter: SimonHengel | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc2 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10398 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * related: => #10398 Comment: The fix for #10398 (d784bdeb62a6b11831c5235a97449ff2a86dcc52) caused this. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11579#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11579: Bug in parser for named Haddock chunks since GHC 8.0.1-rc1 -------------------------------------+------------------------------------- Reporter: SimonHengel | Owner: thomie Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc2 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10398 | Differential Rev(s): Phab:D1935 Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * owner: => thomie * differential: => Phab:D1935 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11579#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11579: Bug in parser for named Haddock chunks since GHC 8.0.1-rc1 -------------------------------------+------------------------------------- Reporter: SimonHengel | Owner: thomie Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc2 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10398 | Differential Rev(s): Phab:D1935 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"6350eb1126e29b93829de688623c91b772f6d9eb/ghc" 6350eb1/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="6350eb1126e29b93829de688623c91b772f6d9eb" 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 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11579#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11579: Bug in parser for named Haddock chunks since GHC 8.0.1-rc1 -------------------------------------+------------------------------------- Reporter: SimonHengel | Owner: thomie Type: bug | Status: merge Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc2 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10398 | Differential Rev(s): Phab:D1935 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => merge -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11579#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11579: Bug in parser for named Haddock chunks since GHC 8.0.1-rc1 -------------------------------------+------------------------------------- Reporter: SimonHengel | Owner: thomie Type: bug | Status: closed Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc2 (Parser) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10398 | Differential Rev(s): Phab:D1935 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged as a69542ba51f7dd1d77b2e16f2b3259263cc375f6. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11579#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC