google / ghc-source-gen

Library for generating Haskell source files and code fragments.
BSD 3-Clause "New" or "Revised" License
91 stars 29 forks source link

Build failure on GHC 9.6 #106

Closed Vekhir closed 10 months ago

Vekhir commented 11 months ago

Hi, when building ghc-source-gen 0.4.3.0 on GHC 9.6.3, the following 5 errors occurred:

Configuring ghc-source-gen-0.4.3.0...
Preprocessing library for ghc-source-gen-0.4.3.0..
Building library for ghc-source-gen-0.4.3.0..
[ 1 of 18] Compiling GHC.SourceGen.Pretty ( src/GHC/SourceGen/Pretty.hs, dist/build/GHC/SourceGen/Pretty.dyn_o )
[ 2 of 18] Compiling GHC.SourceGen.Syntax.Internal ( src/GHC/SourceGen/Syntax/Internal.hs, dist/build/GHC/SourceGen/Syntax/Internal.dyn_o )
[ 3 of 18] Compiling GHC.SourceGen.Name.Internal ( src/GHC/SourceGen/Name/Internal.hs, dist/build/GHC/SourceGen/Name/Internal.dyn_o )
[ 4 of 18] Compiling GHC.SourceGen.Name ( src/GHC/SourceGen/Name.hs, dist/build/GHC/SourceGen/Name.dyn_o )
[ 5 of 18] Compiling GHC.SourceGen.Lit.Internal ( src/GHC/SourceGen/Lit/Internal.hs, dist/build/GHC/SourceGen/Lit/Internal.dyn_o )
[ 6 of 18] Compiling GHC.SourceGen.Pat.Internal ( src/GHC/SourceGen/Pat/Internal.hs, dist/build/GHC/SourceGen/Pat/Internal.dyn_o )
[ 7 of 18] Compiling GHC.SourceGen.Module ( src/GHC/SourceGen/Module.hs, dist/build/GHC/SourceGen/Module.dyn_o )

src/GHC/SourceGen/Module.hs:41:26: error:
    Module ‘GHC.Types.SrcLoc’ does not export ‘LayoutInfo(..)’
   |
41 | import GHC.Types.SrcLoc (LayoutInfo(..))
   |                          ^^^^^^^^^^^^^^
[ 8 of 18] Compiling GHC.SourceGen.Lit ( src/GHC/SourceGen/Lit.hs, dist/build/GHC/SourceGen/Lit.dyn_o )
[ 9 of 18] Compiling GHC.SourceGen.Expr.Internal ( src/GHC/SourceGen/Expr/Internal.hs, dist/build/GHC/SourceGen/Expr/Internal.dyn_o )
[10 of 18] Compiling GHC.SourceGen.Binds.Internal ( src/GHC/SourceGen/Binds/Internal.hs, dist/build/GHC/SourceGen/Binds/Internal.dyn_o )

src/GHC/SourceGen/Binds/Internal.hs:86:11: error: [GHC-83865]
    • Couldn't match type ‘Origin’
                     with ‘Language.Haskell.Syntax.Extension.NoExtField’
      Expected: NoExtField
                -> GHC.Types.SrcLoc.GenLocated
                     (SrcSpanAnn GHC.Parser.Annotation.AnnList)
                     [GHC.Types.SrcLoc.GenLocated
                        (SrcSpanAnn GHC.Parser.Annotation.AnnListItem)
                        (Match
                           GHC.Hs.Extension.GhcPs
                           (GHC.Types.SrcLoc.GenLocated
                              GHC.Parser.Annotation.SrcSpanAnnA
                              (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcPs)))]
                -> Origin
                -> MatchGroup
                     GHC.Hs.Extension.GhcPs
                     (GHC.Types.SrcLoc.GenLocated
                        GHC.Parser.Annotation.SrcSpanAnnA
                        (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcPs))
        Actual: Language.Haskell.Syntax.Extension.XMG
                  GHC.Hs.Extension.GhcPs
                  (GHC.Types.SrcLoc.GenLocated
                     GHC.Parser.Annotation.SrcSpanAnnA
                     (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcPs))
                -> Language.Haskell.Syntax.Extension.XRec
                     GHC.Hs.Extension.GhcPs
                     [Language.Haskell.Syntax.Expr.LMatch
                        GHC.Hs.Extension.GhcPs
                        (GHC.Types.SrcLoc.GenLocated
                           GHC.Parser.Annotation.SrcSpanAnnA
                           (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcPs))]
                -> MatchGroup
                     GHC.Hs.Extension.GhcPs
                     (GHC.Types.SrcLoc.GenLocated
                        GHC.Parser.Annotation.SrcSpanAnnA
                        (Language.Haskell.Syntax.Expr.HsExpr GHC.Hs.Extension.GhcPs))
    • In the first argument of ‘noExt’, namely ‘MG’
      In the expression:
        noExt MG (mkLocated $ map (mkLocated . mkMatch) matches) Generated
      In an equation for ‘matchGroup’:
          matchGroup context matches
            = noExt
                MG (mkLocated $ map (mkLocated . mkMatch) matches) Generated
            where
                mkMatch :: RawMatch -> Match' LHsExpr'
                mkMatch r
                  = withEpAnnNotUsed
                      Match context (map builtPat $ map parenthesize $ rawMatchPats r)
                      (mkGRHSs $ rawMatchGRHSs r)
   |
86 |     noExt MG (mkLocated $ map (mkLocated . mkMatch) matches)
   |           ^^
[11 of 18] Compiling GHC.SourceGen.Type.Internal ( src/GHC/SourceGen/Type/Internal.hs, dist/build/GHC/SourceGen/Type/Internal.dyn_o )
[12 of 18] Compiling GHC.SourceGen.Type ( src/GHC/SourceGen/Type.hs, dist/build/GHC/SourceGen/Type.dyn_o )
[13 of 18] Compiling GHC.SourceGen.Pat ( src/GHC/SourceGen/Pat.hs, dist/build/GHC/SourceGen/Pat.dyn_o )

src/GHC/SourceGen/Pat.hs:43:30: error: [GHC-83865]
    • Couldn't match type: Language.Haskell.Syntax.Extension.XRec
                             p0 (Pat p0)
                           -> Pat p0
                     with: Pat GHC.Hs.Extension.GhcPs
      Expected: EpAnn ann0
                -> GHC.Parser.Annotation.LocatedN GHC.Types.Name.Reader.RdrName
                -> Language.Haskell.Syntax.Extension.XRec
                     p0 (Language.Haskell.Syntax.Concrete.HsToken "@")
                -> Pat'
        Actual: Language.Haskell.Syntax.Extension.XAsPat p0
                -> Language.Haskell.Syntax.Extension.LIdP p0
                -> Language.Haskell.Syntax.Concrete.LHsToken "@" p0
                -> LPat p0
                -> Pat p0
    • Probable cause: ‘AsPat’ is applied to too few arguments
      In the first argument of ‘withEpAnnNotUsed’, namely ‘AsPat’
      In the first argument of ‘($)’, namely
        ‘withEpAnnNotUsed AsPat (valueRdrName v)’
      In the expression:
        withEpAnnNotUsed AsPat (valueRdrName v) $ builtPat $ parenthesize p
   |
43 | v `asP` p = withEpAnnNotUsed AsPat (valueRdrName v) $ builtPat $ parenthesize p
   |                              ^^^^^

src/GHC/SourceGen/Pat.hs:43:55: error: [GHC-83865]
    • Couldn't match type: Pat GHC.Hs.Extension.GhcPs
                     with: Language.Haskell.Syntax.Concrete.HsToken "@"
      Expected: Language.Haskell.Syntax.Extension.XRec
                  p0 (Language.Haskell.Syntax.Concrete.HsToken "@")
        Actual: LPat'
    • In the second argument of ‘($)’, namely
        ‘builtPat $ parenthesize p’
      In the expression:
        withEpAnnNotUsed AsPat (valueRdrName v) $ builtPat $ parenthesize p
      In an equation for ‘asP’:
          v `asP` p
            = withEpAnnNotUsed AsPat (valueRdrName v)
                $ builtPat $ parenthesize p
   |
43 | v `asP` p = withEpAnnNotUsed AsPat (valueRdrName v) $ builtPat $ parenthesize p
   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^
[14 of 18] Compiling GHC.SourceGen.Overloaded ( src/GHC/SourceGen/Overloaded.hs, dist/build/GHC/SourceGen/Overloaded.dyn_o )

src/GHC/SourceGen/Overloaded.hs:289:39: error: [GHC-83865]
    • Couldn't match type: Language.Haskell.Syntax.Extension.XRec
                             p0 (Language.Haskell.Syntax.Extension.IdP p0)
                           -> IEWrappedName p0
                     with: IEWrappedName GHC.Hs.Extension.GhcPs
      Expected: IEWrappedName GHC.Hs.Extension.GhcPs
        Actual: Language.Haskell.Syntax.Extension.LIdP p0
                -> IEWrappedName p0
    • Probable cause: ‘($)’ is applied to too few arguments
      In the second argument of ‘($)’, namely ‘IEName $ exportRdrName n’
      In the second argument of ‘($)’, namely
        ‘mkLocated $ IEName $ exportRdrName n’
      In the expression:
        noExt IEVar $ mkLocated $ IEName $ exportRdrName n
    |
289 |     var n = noExt IEVar $ mkLocated $ IEName $ exportRdrName n
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^

There are two types of issues, one is a missing definition (the first error), the other is failing to match various types (the other 4 errors). I'm not sure how to go about fixing those. Do you have an idea?

System information

OS: Arch Linux Kernel: 6.6.7-arch1-1 GHC: 9.6.3 ghc-source-gen: 0.4.3.0

Vekhir commented 11 months ago

Oh, I forgot that #103 exists. That PR solves this issue once merged.

blackgnezdo commented 10 months ago

https://hackage.haskell.org/package/ghc-source-gen-0.4.4.0 is up and compatible with 9.6.

Vekhir commented 10 months ago

Right, works fine. I'm closing this.