Skip to content
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

Merged
merged 1 commit into from
May 21, 2024
Merged

ghc-lib-parser 9.10 #1103

merged 1 commit into from
May 21, 2024

Conversation

amesgen
Copy link
Member

@amesgen amesgen commented Mar 11, 2024

Update to ghc-lib-parser-9.10, build with GHC 9.10.1 in CI, drop GHC 9.4, update bounds.

  • See the changelog for details about the new syntactic features in GHC 9.10.
  • We can remove our HasSrcSpan in favor of ghc-lib-parser's HasLoc.
  • The EPA extension points in constructors do (usually) no longer contain the comments (they are now usually in the annotation part of a Located). We relied on this in p_if (as of Fix comments in if blocks #1092). Instead of laboriously passing the comments down from where we unwrap the LHsExpr, I added a new function getEnclosingComments to the R monad that leverages the comment stream, as that seemed much less invasive.
  • See the review comments for some further minor points.

Copy link

github-actions bot commented May 4, 2024

@github-actions github-actions bot temporarily deployed to pull request May 4, 2024 20:48 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 4, 2024 21:38 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 4, 2024 21:51 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 10, 2024 21:34 Inactive
@amesgen amesgen marked this pull request as ready for review May 10, 2024 21:35
@github-actions github-actions bot temporarily deployed to pull request May 12, 2024 13:06 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 13, 2024 09:29 Inactive

This comment was marked as off-topic.

@github-actions github-actions bot temporarily deployed to pull request May 18, 2024 12:48 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 21, 2024 09:32 Inactive
@amesgen amesgen requested a review from mrkkrp May 21, 2024 09:49
@tchoutri
Copy link

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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see!

@mrkkrp mrkkrp merged commit 0d33770 into master May 21, 2024
10 checks passed
@amesgen amesgen deleted the amesgen/ghc-9.10 branch May 21, 2024 16:29
Comment on lines -18 to +21
-- \| 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
Copy link
Collaborator

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?

Copy link
Member Author

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 a DocD 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:

-- 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants