-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Haddock comment to the last data constructor is attached incorrectly #421
Comments
it's hard to see how the parse tree produced by ghc-lib-parser can be different from GHC itself since it's the same source code cc @alanz |
Ok, I also thought so. I haven't tried to rewrite everything using This AST was produced by |
never say never of course but i'm confident this is something to be discussed in the ghc repo with alan zimmerman.
in case it helps, i put your example program in a file
i didn't look deeply but a quick glance suggest the haddock comments are associated with their respective data ctors? this was using ghc-9.4.2 (i don't expect ghc-9.4.3 to be any different). this output i think comes from |
I found the problem: stylish-haskell (and my AST-printer) parsed the module without |
Working around the stylish-haskell bug I was very surprised to see, that haddock comments in the AST produced by
ghc-lib-parser
are located in the such strange way: all comments, except the last one, are attached to theDataDecl
, while the last one --- to theTyClD
.Consider the following declaration:
We get this AST:
The text was updated successfully, but these errors were encountered: