Skip to content

Fails to compile in ghc 9.14 #159

@danwdart

Description

@danwdart

Even with --allow-newer, it looks like the ghc api has changed again significantly enough to break it:

[1 of 9] Compiling Paths_apply_refact ( dist/build/refactor/autogen/Paths_apply_refact.hs, dist/build/refactor/refactor-tmp/Paths_apply_refact.o )
[2 of 9] Compiling Refact.Compat    ( src/Refact/Compat.hs, dist/build/refactor/refactor-tmp/Refact/Compat.o )
src/Refact/Compat.hs:131:51: warning: [GHC-61689] [-Wdodgy-imports]
    Module ‘GHC.Hs’ does not export ‘ann’.
    |
131 | import GHC.Hs hiding (Pat, Stmt, parseModuleName, ann)
    |                                                   ^^^

[3 of 9] Compiling Refact.Utils     ( src/Refact/Utils.hs, dist/build/refactor/refactor-tmp/Refact/Utils.o )
[4 of 9] Compiling Refact.Internal  ( src/Refact/Internal.hs, dist/build/refactor/refactor-tmp/Refact/Internal.o )
src/Refact/Internal.hs:614:7: error: [GHC-83865]
    • Couldn't match type: [GHC.GenLocated a1 e0]
                     with: ghc-internal-9.1401.0:GHC.Internal.Base.NonEmpty
                             (GHC.GenLocated
                                GHC.EpAnnCO
                                (GHC.GRHS
                                   GHC.GhcPs
                                   (GHC.GenLocated GHC.SrcSpanAnnA (GHC.HsExpr GHC.GhcPs))))
      Expected: ghc-internal-9.1401.0:GHC.Internal.Base.NonEmpty
                  (GHC.LGRHS
                     GHC.GhcPs (GHC.GenLocated GHC.SrcSpanAnnA (GHC.HsExpr GHC.GhcPs)))
        Actual: [GHC.GenLocated a1 e0]
    • In the pattern: [GHC.L loc2 _]
      In a stmt of a pattern guard for
                     a \case alternative:
        [GHC.L loc2 _] <- GHC.grhssGRHSs origGRHSs
      In a \case alternative:
          GHC.L _ (GHC.ValD xvald origBind@GHC.FunBind {})
            | let origMG = GHC.fun_matches origBind,
              GHC.L locMG [GHC.L locMatch origMatch] <- GHC.mg_alts origMG,
              let origGRHSs = GHC.m_grhss origMatch,
              [GHC.L loc2 _] <- GHC.grhssGRHSs origGRHSs
            -> let
                 loc1 = GHC.getLoc (GHC.fun_id origBind)
                 newLoc = combineSrcSpansA (GHC.l2l loc1) (GHC.l2l loc2)
                 ....
               in Just (withoutLocalBinds, GHC.grhssLocalBinds origGRHSs)
    |
614 |       [GHC.L loc2 _] <- GHC.grhssGRHSs origGRHSs ->
    |       ^^^^^^^^^^^^^^

src/Refact/Internal.hs:828:7: error: [GHC-83865]
    • Couldn't match expected type: FilePath
                                    -> (GHC.Types.Error.Messages GHC.Parser.Errors.Types.PsMessage,
                                        [GHC.Located String])
                  with actual type: (a0, GHC.DynFlags)
    • In the pattern: (_, opts)
      In a pattern binding:
        (_, opts) = getOptions (initParserOpts flags) buf fp
      In a stmt of a 'do' block:
        let (_, opts) = getOptions (initParserOpts flags) buf fp
            withExts
              = flip (foldl' xopt_unset) ds . flip (foldl' xopt_set) es $ flags
    |
828 |   let (_, opts) = getOptions (initParserOpts flags) buf fp
    |       ^^^^^^^^^

src/Refact/Internal.hs:828:53: error: [GHC-83865]
    • Couldn't match expected type ‘[String]’
                  with actual type ‘GHC.Data.StringBuffer.StringBuffer’
    • In the second argument of ‘getOptions’, namely ‘buf’
      In the expression: getOptions (initParserOpts flags) buf fp
      In a pattern binding:
        (_, opts) = getOptions (initParserOpts flags) buf fp
    |
828 |   let (_, opts) = getOptions (initParserOpts flags) buf fp
    |                                                     ^^^

src/Refact/Internal.hs:828:57: error: [GHC-83865]
    • Couldn't match expected type ‘GHC.Data.StringBuffer.StringBuffer’
                  with actual type ‘[Char]’
    • In the third argument of ‘getOptions’, namely ‘fp’
      In the expression: getOptions (initParserOpts flags) buf fp
      In a pattern binding:
        (_, opts) = getOptions (initParserOpts flags) buf fp
    |
828 |   let (_, opts) = getOptions (initParserOpts flags) buf fp
    |                                                         ^^

src/Refact/Internal.hs:836:26: error: [GHC-83865]
    • Couldn't match expected type: IO (GHC.DynFlags, b0, c0)
                  with actual type: [GHC.Located String]
                                    -> m0
                                         (GHC.DynFlags, [GHC.Located String],
                                          GHC.Types.Error.Messages
                                            GHC.Driver.Errors.Types.DriverMessage)
    • Probable cause: ‘parseDynamicFilePragma’ is applied to too few arguments
      In a stmt of a 'do' block:
        (withPragmas, _, _) <- parseDynamicFilePragma withExts opts
      In the second argument of ‘($)’, namely
        ‘do (stringToStringBuffer -> buf) <- readFileUTF8' fp
            let (_, opts) = getOptions (initParserOpts flags) buf fp
                withExts
                  = flip (foldl' xopt_unset) ds . flip (foldl' xopt_set) es $ flags
            (withPragmas, _, _) <- parseDynamicFilePragma withExts opts
            pure . Right $ withPragmas `gopt_set` GHC.Opt_KeepRawTokenStream’
      In the expression:
        catchErrors
          $ do (stringToStringBuffer -> buf) <- readFileUTF8' fp
               let (_, opts) = getOptions (initParserOpts flags) buf fp
                   withExts
                     = flip (foldl' xopt_unset) ds . flip (foldl' xopt_set) es $ flags
               (withPragmas, _, _) <- parseDynamicFilePragma withExts opts
               pure . Right $ withPragmas `gopt_set` GHC.Opt_KeepRawTokenStream
    |
836 |   (withPragmas, _, _) <- parseDynamicFilePragma withExts opts
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Refact/Internal.hs:836:49: error: [GHC-83865]
    • Couldn't match expected type ‘GHC.Logger’
                  with actual type ‘GHC.DynFlags’
    • In the first argument of ‘parseDynamicFilePragma’, namely
        ‘withExts’
      In a stmt of a 'do' block:
        (withPragmas, _, _) <- parseDynamicFilePragma withExts opts
      In the second argument of ‘($)’, namely
        ‘do (stringToStringBuffer -> buf) <- readFileUTF8' fp
            let (_, opts) = getOptions (initParserOpts flags) buf fp
                withExts
                  = flip (foldl' xopt_unset) ds . flip (foldl' xopt_set) es $ flags
            (withPragmas, _, _) <- parseDynamicFilePragma withExts opts
            pure . Right $ withPragmas `gopt_set` GHC.Opt_KeepRawTokenStream’
    |
836 |   (withPragmas, _, _) <- parseDynamicFilePragma withExts opts
    |                                                 ^^^^^^^^

src/Refact/Internal.hs:891:37: error: [GHC-83865]
    • Couldn't match expected type: (Extension,
                                     GHC.Driver.Flags.OnOff Extension)
                  with actual type: (Extension, Bool, Extension)
    • In the pattern: (a, True, b)
      In a stmt of a list comprehension: (a, True, b) <- impliedXFlags
      In the expression:
        [b | ext <- ys, (a, True, b) <- impliedXFlags, a == ext]
    |
891 |         impliedOn = [b | ext <- ys, (a, True, b) <- impliedXFlags, a == ext]
    |                                     ^^^^^^^^^^^^

src/Refact/Internal.hs:892:38: error: [GHC-83865]
    • Couldn't match expected type: (Extension,
                                     GHC.Driver.Flags.OnOff Extension)
                  with actual type: (Extension, Bool, Extension)
    • In the pattern: (a, False, b)
      In a stmt of a list comprehension: (a, False, b) <- impliedXFlags
      In the expression:
        [b | ext <- ys, (a, False, b) <- impliedXFlags, a == ext]
    |
892 |         impliedOff = [b | ext <- ys, (a, False, b) <- impliedXFlags, a == ext]
    |                                      ^^^^^^^^^^^^^

[6 of 9] Compiling Refact.Fixity    ( src/Refact/Fixity.hs, dist/build/refactor/refactor-tmp/Refact/Fixity.o )
src/Refact/Fixity.hs:12:36: warning: [GHC-38856] [-Wunused-imports]
    The import of ‘SourceText’ from module ‘Refact.Compat’ is redundant
   |
12 | import Refact.Compat (Fixity (..), SourceText (..), occNameString, rdrNameOcc,transferEntryDP)
   |                                    ^^^^^^^^^^^^^^^

Any chance this can be addressed to keep up?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions