-
Notifications
You must be signed in to change notification settings - Fork 81
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
ghc-lib-parser 9.10 #1103
ghc-lib-parser 9.10 #1103
Conversation
15d8a38
to
2e76dad
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
I'm very excited for this PR to land, I am starting a project with GHC 9.10. :) |
@@ -3,7 +3,6 @@ | |||
let | |||
inherit (pkgs) lib; | |||
expectedFailures = [ | |||
"Agda" | |||
"brittany" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to see!
-- \| The name of the primitive used as the seed stretcher | ||
-- \| Test line 2 | ||
-- | The name of the primitive used as the seed stretcher | ||
-- | Test line 2 | ||
-- | Test line 3 | ||
-- \|Test line 4 | ||
-- |Test line 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was curious why this changed. Seems like GHC merged a change that causes signature modules to now parse Haddocks correctly. So now ghc-lib-parser returns an AST containing HsDocStringChunk " | Test line 2"
instead of the previously incorrect EpaLineComment " \\| Test line 2"
.
However, now I see that these docs are in two places: in an EpaComments
annotation and in a DocD
declaration. I can't find the logic that prevents Ormolu from printing these out twice. Anyone know where that is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, now I see that these docs are in two places: in an
EpaComments
annotation and in aDocD
declaration.
Yeah, this has always been the case, see e.g. #901 (comment) for another example/more context.
I can't find the logic that prevents Ormolu from printing these out twice. Anyone know where that is?
It is here, specifically line 75:
ormolu/src/Ormolu/Parser/CommentStream.hs
Lines 71 to 78 in a9e996b
-- We want to extract all comments except _valid_ Haddock comments | |
rawComments0 = | |
fmap (uncurry L) | |
. M.toAscList | |
. flip M.withoutKeys validHaddockCommentSpans | |
. M.fromList | |
. fmap (\(L l a) -> (l, a)) | |
$ allComments |
Update to
ghc-lib-parser-9.10
, build with GHC 9.10.1 in CI, drop GHC 9.4, update bounds.HasSrcSpan
in favor ofghc-lib-parser
'sHasLoc
.Located
). We relied on this inp_if
(as of Fix comments in if blocks #1092). Instead of laboriously passing the comments down from where we unwrap theLHsExpr
, I added a new functiongetEnclosingComments
to theR
monad that leverages the comment stream, as that seemed much less invasive.