-
Notifications
You must be signed in to change notification settings - Fork 195
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
Convert to ghc-9.2.1 #1247
Convert to ghc-9.2.1 #1247
Conversation
Cc @alanz All done mate. |
f34254c
to
918a74e
Compare
Awesome work! |
GHC 9.2.1 is now out. Thoughts on this? |
Got it. Time to move on it then. Leave it with me for now and I'll keep you posted. |
For the apply-refact part it will need me to complete my current ghc-exactprint update. Which is getting close. |
I'm in no tearing rush - a leisurely upgrade is fine :) |
918a74e
to
6a65c5e
Compare
i rebased this branch on master today (oct 30, 2021). the tests all pass but this one in 'Extensions.hs':
which produces the apparently unexpected output
(using the 9.2.1 release candidate ghc-lib-parser-9.2.1.20210509.tar.gz that the this test was introduced only recently in #1277. @zliu41 as the author of that test might i trouble you to take a look? i removed the test for the moment. this puts us in a good place for the next step: upgrade this branch to the ghc-lib-parser and ghc-lib-parser-ex newly released 9.2.1 official versions. |
@shayne-fletcher Removing that test for now is good. Once you make cabal build work for this patch, I can look into it - otherwise it's difficult for me to investigate. |
@shayne-fletcher Maybe it's good to go now for GHC 9.2.1? |
yep, it's high priority with us too. don't worry @LeventErkok , we got you! little patience please 😉 |
a077cc4
to
cc81186
Compare
@ndmitchell i believe this is ready to merge. all 813 tests pass locally. please note that minimum build compiler is now 8.10.1. |
p.s. locally my testing was with |
b11504e
to
a9617d0
Compare
@zliu41 |
a9617d0
to
1e615c0
Compare
Thanks! @shayne-fletcher - can you add a CI for GHC 9.2 and remove it for GHC 8.8 (see the It seems the Windows and Mac CI are both bust installing apply-refact. Any idea why? I'll take a peek through the code now |
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 work!
1e615c0
to
288694b
Compare
pushed
no idea about that sorry.
|
It depends on ghc-exactprint, the release on hackage does not compile with GHC 9.2.1 as released. I will be making a new release tomorrow, just need to clean up a few tests |
288694b
to
738c8c9
Compare
Thanks @alanz - my plan is to hold this PR in limbo a few days, merge nothing else to the repo in the intervening time, and wait for ghc-exactprint, then pull the trigger on this. |
I just published ghc-exactprint-1.3.0 |
hi, if all's good can we merge and publish this ? looking forward : ) |
# hlint: | ||
# ghc-lib: true | ||
# ghc-lib-parser-ex: | ||
# auto: false | ||
# no-ghc-lib: false |
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.
This re-indentation doesn’t seem like a reasonable change. There must be at least 1 space after #
(see flags
). But after hlint
there are two, which means the indentation is 1 but ghc-lib
has 2 for indentation.
# hlint: | |
# ghc-lib: true | |
# ghc-lib-parser-ex: | |
# auto: false | |
# no-ghc-lib: false | |
# hlint: | |
# ghc-lib: true | |
# ghc-lib-parser-ex: | |
# auto: false | |
# no-ghc-lib: false |
args <- getArgs | ||
errs <- hlint args | ||
unless (null errs) $ | ||
exitWith $ ExitFailure 1 |
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.
5 spaces for indentation? But still the exitWith
has 4.
args <- getArgs | |
errs <- hlint args | |
unless (null errs) $ | |
exitWith $ ExitFailure 1 | |
args <- getArgs | |
errs <- hlint args | |
unless (null errs) $ | |
exitWith $ ExitFailure 1 |
IEName n -> fromId (unLoc n) | ||
IEPattern _ n -> ("pattern " ++) <$> fromId (unLoc n) | ||
IEType _ n-> ("type " ++) <$> fromId (unLoc n) |
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.
Broken alignment:
IEName n -> fromId (unLoc n) | |
IEPattern _ n -> ("pattern " ++) <$> fromId (unLoc n) | |
IEType _ n-> ("type " ++) <$> fromId (unLoc n) | |
IEName n -> fromId (unLoc n) | |
IEPattern _ n -> ("pattern " ++) <$> fromId (unLoc n) | |
IEType _ n -> ("type " ++) <$> fromId (unLoc n) |
res = [x | x <- hsmodImports xs | ||
, pkg x /= Just (StringLiteral NoSourceText (fsLit "hint") Nothing) | ||
] |
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.
res = [x | x <- hsmodImports xs | |
, pkg x /= Just (StringLiteral NoSourceText (fsLit "hint") Nothing) | |
] | |
res = [x | x <- hsmodImports xs, pkg x /= Just (StringLiteral NoSourceText (fsLit "hint") Nothing)] |
adjustMessage x = | ||
"Parse error: " ++ | ||
dropBrackets ( | ||
case stripInfix "parse error " x of | ||
Nothing -> x | ||
Just (prefix, _) -> | ||
dropPrefix (prefix ++ "parse error ") x | ||
) |
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.
adjustMessage x = | |
"Parse error: " ++ | |
dropBrackets ( | |
case stripInfix "parse error " x of | |
Nothing -> x | |
Just (prefix, _) -> | |
dropPrefix (prefix ++ "parse error ") x | |
) | |
adjustMessage x = | |
"Parse error: " ++ dropBrackets errMsg | |
where | |
errMsg = maybe x (\(pfx, _) -> dropPrefix (pfx ++ subStr) x) (stripInfix subStr x) | |
subStr = "parse error " |
It's got to the stage where we need to move, so landing, and will fix forward if we need to. |
Merged, but all the CI is red on GHC 9.2 because apply-refact is not yet GHC 9.2 compatiblehttps://github.com/mpickering/apply-refact/issues/114 |
I am working on the failing tests for apply-refact, and came across yes = if (f x) then y else z and a corresponding apply-refact refactoring of [("tests/examples/Bracket7.hs:1:10-14: Suggestion: Redundant bracket\nFound:\n if (f x) then y else z\nPerhaps:\n if f x then y else z\n"
,[Replace
{ rtype = Expr
, pos = SrcSpan {startLine = 1, startCol = 10, endLine = 1, endCol = 15}
, subts = [("x",SrcSpan {startLine = 1, startCol = 11, endLine = 1, endCol = 14})]
, orig = "x"}])] I presume that only the positions are meaningful, as in "substitute 1:10-15 with 1:11-14", and the reference to |
@alanz - @zliu41 is the expert here. I think (but am most definitely not sure) that the code is saying:
But that's just a guess on what I think it's doing. |
That seems to make sense. So the "x" is a "hlint variable", rather than a quote of existing source code. |
@alanz Yeah "x" is a template variable. In this case it happens to be the entire template ( |
mpickering/apply-refact#116 is ready for review, should hopefully unblock this |
This is a complete port of HLint to the ghc-9.2.1 parse tree. All tests pass.