[GHC] #8944: Warn instead of stopping on misplaced Haddock comments
GHC
ghc-devs at haskell.org
Sun Nov 2 14:12:18 UTC 2014
#8944: Warn instead of stopping on misplaced Haddock comments
-------------------------------------+-------------------------------------
Reporter: Fuuzetsu | Owner:
Type: feature | Status: new
request | Milestone:
Priority: normal | Version: 7.9
Component: Compiler | Keywords:
(Parser) | Architecture: Unknown/Multiple
Resolution: | Difficulty: Unknown
Operating System: | Blocked By:
Unknown/Multiple | Related Tickets:
Type of failure: |
None/Unknown |
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by rodlogic):
The following break GHC's validate (see
https://phabricator.haskell.org/harbormaster/build/1562/)
{{{
-- * base
import Control.Monad ( unless, liftM )
import GHC.Exts
import Data.Char
import Control.Monad ( mplus )
-- * compiler/hsSyn
import HsSyn
}}}
I ended up having to remove '*' from the comment for it to work:
{{{
-- base
import Control.Monad ( unless, liftM )
import GHC.Exts
import Data.Char
import Control.Monad ( mplus )
-- compiler/hsSyn
import HsSyn
}}}
This seems to be the relevant part in Lexer.x:
{{{
"-- " ~[$docsym \#] .* { lineCommentToken }
"--" [^$symbol \ ] .* { lineCommentToken }
-- Next, match Haddock comments if no -haddock flag
"-- " [$docsym \#] .* / { ifExtension (not . haddockEnabled) } {
lineCommentToken }
-- Now, when we've matched comments that begin with 2 dashes and continue
-- with a different character, we need to match comments that begin with
three
-- or more dashes (which clearly can't be Haddock comments). We only need
to
-- make sure that the first non-dash character isn't a symbol, and munch
the
-- rest of the line.
"---"\-* ~$symbol .* { lineCommentToken }
-- Since the previous rules all match dashes followed by at least one
-- character, we also need to match a whole line filled with just dashes.
"--"\-* / { atEOL } { lineCommentToken }
-- We need this rule since none of the other single line comment rules
-- actually match this case.
"-- " / { atEOL } { lineCommentToken }
}}}
And it seems that there is no case for when {{{haddockEnabled}}} is true.
What should be the action for such rule?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8944#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list