Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,861
    • Issues 4,861
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 456
    • Merge requests 456
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #17426
Closed
Open
Created Nov 01, 2019 by Artyom Kazak@neongreen

Postfix Haddock comments on unnamed constructor fields can be lost

Summary

The -- ^ comment here is lost from the parse tree:

data Foo
  = -- | Cons 1
    Cons
      Int -- ^ Field 1
ghc -haddock -fforce-recomp -ddump-parsed /tmp/z.hs
[1 of 1] Compiling Main             ( /tmp/z.hs, /tmp/z.o )

==================== Parser ====================
data Foo = " Cons 1" Cons Int

Notes

The comment is treated as a constructor Haddock if -- | Cons 1 is removed (this is also questionable behavior):

data Foo
  = Cons
      Int  -- ^ Field 1
==================== Parser ====================
data Foo = " Field 1" Cons Int

The comment is treated as a field Haddock if there is more than one field (this is the right behavior):

data Foo
  = Cons
      Int  -- ^ Field 1
      Bool -- ^ Field 2
==================== Parser ====================
data Foo = Cons Int " Field 1" Bool " Field 2"

Environment

  • GHC version used: 8.9.0.20191031
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking