Skip to content

Wrong Doc Identifier span in the parsed source.

Summary

The Identifier span in the nested_doc_comment is wrong

Steps to reproduce

make a file hello.hs

module Hello where
{- | `Nothing`
-}

generate the parsed source,

main :: IO ()
main = do
    let filePath = "hello.hs"
    runGhc (Just libdir) $ do
        dflags <- getSessionDynFlags
        let dflags' = gopt_set dflags Opt_Haddock
        setSessionDynFlags dflags'
        target <- guessTarget filePath Nothing Nothing
        setTargets [target]
        load LoadAllTargets
        modSum <- getModSummary $ mkModuleName "Hello"
        parsedModule <- parseModule modSum

I get the identifier Nothing in the doc, which in wrong location.

[(L { hello.hs:2:3-9 }
          (Unqual
           {OccName: Nothing}))]

Expected behavior

parsed source give the correct location of Nothing in the doc

[(L { hello.hs:2:7-13 }
          (Unqual
           {OccName: Nothing}))]

Environment

  • GHC version used: The Glorious Glasgow Haskell Compilation System, version 9.8.1

Optional:

  • Operating System: Macos 14.2.1 (23C71)
  • System Architecture: arm64
Edited by Patrick
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information