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

GHC 9.4 compatibility #99

Closed ysangkok closed 1 year ago

ysangkok commented 2 years ago

If I override the bounds, I currently get this error, building with GHC 9.4:

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.o, 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.o, 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.o, 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.o, 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.o, 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.o, dist/build/GHC/SourceGen/Pat/Internal.dyn_o )

src/GHC/SourceGen/Pat/Internal.hs:54:27: error:
    • Couldn't match type: Language.Haskell.Syntax.Extension.XRec
                             p0 (Pat p0)
                           -> Language.Haskell.Syntax.Extension.XRec
                                p0 (Language.Haskell.Syntax.Extension.HsToken ")")
                           -> Pat p0
                     with: Pat GHC.Hs.Extension.GhcPs
      Expected: GHC.Parser.Annotation.EpAnn ann0
                -> Language.Haskell.Syntax.Extension.XRec
                     p0 (Language.Haskell.Syntax.Extension.HsToken "(")
                -> Pat'
        Actual: Language.Haskell.Syntax.Extension.XParPat p0
                -> Language.Haskell.Syntax.Extension.LHsToken "(" p0
                -> Language.Haskell.Syntax.Pat.LPat p0
                -> Language.Haskell.Syntax.Extension.LHsToken ")" p0
                -> Pat p0
    • Probable cause: ‘ParPat’ is applied to too few arguments
      In the first argument of ‘withEpAnnNotUsed’, namely ‘ParPat’
      In the first argument of ‘(.)’, namely ‘withEpAnnNotUsed ParPat’
      In the expression: withEpAnnNotUsed ParPat . builtPat
   |
54 | parPat = withEpAnnNotUsed ParPat . builtPat
   |                           ^^^^^^
blackgnezdo commented 2 years ago

This appears to be a genuine change in GHC internal AST. The bounds are working as expected. Somebody will have to invest the effort into updating ghc-source-gen to support the new GHC version.