Skip to content

Add GHC 9 support #84

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 25 commits into from
Closed

Conversation

AriFordsham
Copy link
Contributor

I've modified ghc-source-gen so it builds and passes tests on GHC 9.0.1. I hope you find this useful for #77.

It's not production-ready; I just 'brute-forced' it - I definitely broke GHC 8.10, and I just stubbed out any new features etc. with whatever seemed to make sense to allow building.

I had to comment out two tests to get it to build; all other tests are passing.

Main issues:

  • HsTyVarBndr now has a Specificity flag
  • linear arrows in `infixCon``
  • Various pass-dependent things have been lifted to type-level and now have less fields. Especially troublesome are the ConPat constructor(s)

@google-cla
Copy link

google-cla bot commented Aug 1, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@AriFordsham
Copy link
Contributor Author

@googlebot I signed it!

@AriFordsham
Copy link
Contributor Author

Please note I added a GHC 9 CI job and deleted the others.

@blackgnezdo
Copy link
Contributor

Please note I added a GHC 9 CI job and deleted the others.

Is supporting at least ghc 8.10 too much trouble? I'm worried about single-target releases.

@blackgnezdo
Copy link
Contributor

Please note I added a GHC 9 CI job and deleted the others.

Is supporting at least ghc 8.10 too much trouble? I'm worried about single-target releases.

I think I understand now, this PR shows what it takes to get ghc 9 compatibility. Somebody needs to finish the change so that multiple versions can coexist.

This makes sense, thanks for the PR!

@blackgnezdo blackgnezdo added the help wanted Extra attention is needed label Aug 2, 2021
@AriFordsham
Copy link
Contributor Author

Please note I added a GHC 9 CI job and deleted the others.

Is supporting at least ghc 8.10 too much trouble? I'm worried about single-target releases.

I think I understand now, this PR shows what it takes to get ghc 9 compatibility. Somebody needs to finish the change so that multiple versions can coexist.

This makes sense, thanks for the PR!

I don't even know if new functionality is correct. I just know it builds.

@AriFordsham AriFordsham changed the title Get it to build with GHC 9 Add GHC 9 support Aug 2, 2021
@AriFordsham
Copy link
Contributor Author

I think GHC 9 support #77 can be considered working experimentally at this stage: There's no new GHC 9 features, and I can't garantee I haven't broken anything making the neccesary GHC 9 changes. GHC 8 should be working unchanged.

Copy link
Contributor

@blackgnezdo blackgnezdo left a comment

Choose a reason for hiding this comment

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

Looks like we had a pre-existing lie:
https://www.stackage.org/lts-15.13 is for ghc-8.8.3 and so when I run your change in with ghc 8.10 I hit:

ghc-source-gen      >         
ghc-source-gen      > /home/greg/s/ghc-source-gen/src/GHC/SourceGen/Decl.hs:174:25: error:
ghc-source-gen      >     Data constructor not in scope: NoLayoutInfo :: NoExtField
ghc-source-gen      >     |   
ghc-source-gen      > 174 |             , tcdCExt = NoLayoutInfo 
ghc-source-gen      >     |                         ^^^^^^^^^^^^
ghc-source-gen      >         

I'll update the CI to be less broken.

@blackgnezdo
Copy link
Contributor

Could you rebase on top of #85 and make the tests pass?

@AriFordsham
Copy link
Contributor Author

AriFordsham commented Aug 3, 2021

I'll look at it sometime. I also remember that I left two test cases commented out - I should try to fix those, or at least document if I've broken the API.

Reinstated CI
GHC 8 should be as was
No new GHC 9 functionality; can't be sure I haven't broken anything on
GHC 9
Attempt GHC 9 CI fix by clearing cache
@google-cla
Copy link

google-cla bot commented Aug 3, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@AriFordsham
Copy link
Contributor Author

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@blackgnezdo

@google-cla
Copy link

google-cla bot commented Aug 3, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla
Copy link

google-cla bot commented Aug 3, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

1 similar comment
@google-cla
Copy link

google-cla bot commented Aug 3, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla
Copy link

google-cla bot commented Aug 3, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

1 similar comment
@google-cla
Copy link

google-cla bot commented Aug 3, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

Copy link
Contributor Author

@AriFordsham AriFordsham left a comment

Choose a reason for hiding this comment

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

I've marked all meaningful changes.

@@ -24,9 +31,15 @@ needsPar (NPat _ l _ _) = overLitNeedsParen $ unLoc l
needsPar (LitPat l) = litNeedsParen l
needsPar (NPat l _ _ _) = overLitNeedsParen $ unLoc l
#endif
#if MIN_VERSION_ghc(9,0,1)
-- Think this is correct; can't be sure - AF
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please confirm this is correct.

name
$ PrefixCon
#if MIN_VERSION_ghc(9,0,1)
$ map (HsScaled (HsUnrestrictedArrow NormalSyntax) . renderField)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

HsConDetails of HsConDeclDetails now yas HsScaled wrapped around its first field. I've stubbed this with (HsScaled (HsUnrestrictedArrow NormalSyntax)

)
(
#if MIN_VERSION_ghc(9,0,1)
HsScaled (HsUnrestrictedArrow NormalSyntax) $
Copy link
Contributor Author

Choose a reason for hiding this comment

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

instance BVar HsTyVarBndr' where
#if MIN_VERSION_ghc(9,0,1)
instance BVar HsTyVarBndrSpec' where
bvar = noExt UserTyVar SpecifiedSpec . typeRdrName . UnqualStr
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No idea whether this is correct

h
neverQualify
#if MIN_VERSION_ghc(9,0,1)
AllTheWay
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't know whether this is correct

a --> b =
noExt HsFunTy
#if MIN_VERSION_ghc(9,0,1)
(HsUnrestrictedArrow NormalSyntax)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again, stubbed out linear arrow type

#if MIN_VERSION_ghc(8,10,0)
, tcdCExt = NoExtField
#if MIN_VERSION_ghc(9,0,1)
, tcdCExt = NoLayoutInfo
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't know if this is right

@@ -49,6 +56,9 @@ module'
-> HsModule'
module' name exports imports decls = HsModule
{ hsmodName = fmap (builtLoc . unModuleNameStr) name
#if MIN_VERSION_ghc(9,0,1)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@blackgnezdo
Copy link
Contributor

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

Googlers: Go here for more info.

Could you rebase on top of HEAD and force-push this to clear the complaint?

@google-cla
Copy link

google-cla bot commented Aug 4, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@blackgnezdo
Copy link
Contributor

@judah it would be great if you could look at the code as @AriFordsham has some semantic questions that will take me a while to get up to speed with.

@blackgnezdo blackgnezdo mentioned this pull request Aug 4, 2021
@AriFordsham
Copy link
Contributor Author

I think #86 is unequivocally better than this.

@AriFordsham AriFordsham closed this Aug 5, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants