guibou / PyF

Haskell QuasiQuoter for String Formatting
BSD 3-Clause "New" or "Revised" License
66 stars 13 forks source link

Incomplete patterns on GHC 9.2.4 #108

Closed coderfromhere closed 2 years ago

coderfromhere commented 2 years ago

Hi, I'm getting this error when compiling a project with GHC 9.2.4, which worked on 9.2.3:

• Exception when trying to run compile-time code:
        src/PyF/Internal/Meta.hs:(212,1)-(347,76): Non-exhaustive patterns in function translateTHtoGHCExt

      Code: template-haskell-2.18.0.0:Language.Haskell.TH.Quote.quoteExp
              fmt "{commonPrefix}_db_errors_total"
    • In the quasi-quotation: [fmt|{commonPrefix}_db_errors_total|]

I'm using the latest PyF release.

coderfromhere commented 2 years ago

While running PyF tests with Nix build:

src/PyF/Internal/Meta.hs:212:1: warning: [-Wincomplete-patterns]
    Pattern match(es) are non-exhaustive
    In an equation for ‘translateTHtoGHCExt’:
        Patterns of type ‘TH.Extension’ not matched: TH.DeepSubsumption
    |
212 | translateTHtoGHCExt TH.Cpp = GhcTH.Cpp
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
[6 of 8] Compiling PyF.Internal.PythonSyntax ( src/PyF/Internal/PythonSyntax.hs, dist/build/PyF/Internal/PythonSyntax.o, dist/build/PyF/Internal/PythonSyntax.dyn_o )
[7 of 8] Compiling PyF.Internal.QQ  ( src/PyF/Internal/QQ.hs, dist/build/PyF/Internal/QQ.o, dist/build/PyF/Internal/QQ.dyn_o )
[8 of 8] Compiling PyF              ( src/PyF.hs, dist/build/PyF.o, dist/build/PyF.dyn_o )
Preprocessing test suite 'pyf-test' for PyF-0.10.2.0..
Building test suite 'pyf-test' for PyF-0.10.2.0..
[1 of 3] Compiling SpecCustomDelimiters ( test/SpecCustomDelimiters.hs, dist/build/pyf-test/pyf-test-tmp/SpecCustomDelimiters.o, dist/build/pyf-test/pyf-test-tmp/SpecCustomDelimiters.dyn_o )
[2 of 3] Compiling SpecUtils        ( test/SpecUtils.hs, dist/build/pyf-test/pyf-test-tmp/SpecUtils.o, dist/build/pyf-test/pyf-test-tmp/SpecUtils.dyn_o )
[3 of 3] Compiling Main             ( test/Spec.hs, dist/build/pyf-test/pyf-test-tmp/Main.o, dist/build/pyf-test/pyf-test-tmp/Main.dyn_o )

test/Spec.hs:69:16: error:
    • Exception when trying to run compile-time code:
        src/PyF/Internal/Meta.hs:(212,1)-(347,76): Non-exhaustive patterns in function translateTHtoGHCExt

      Code: Language.Haskell.TH.Quote.quoteExp fmt "{anInt}"
    • In the quasi-quotation: [fmt|{anInt}|]
   |
69 |     it "int" $ [fmt|{anInt}|] `shouldBe` "123"
   |                ^^^^^^^^^^^^^^
error: builder for '/nix/store/qjn8wiqlaal735jphsar6ykp69qfi4ql-PyF-0.10.2.0.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/ysrla6h5j91niq2dz9xv62n8gf35lmyb-red-lib-0.2.9.0.drv' failed to build
make: *** [Makefile:75: build] Error 100
tchoutri commented 2 years ago

I just run on the same error while upgrading Flora to 9.2.4

guibou commented 2 years ago

Thank you for this report. I'm having a look at it.

guibou commented 2 years ago

Haa, yes, I think this is fixed in the currently unreleased version. It is similar to the report from stack here: https://github.com/commercialhaskell/stackage/issues/6665

It should be fixed in the main branch, considering that translateThToGHCExt had been removed.

guibou commented 2 years ago

I'm doing a release once #106 is merged.

guibou commented 2 years ago

New release https://hackage.haskell.org/package/PyF-0.11.0.0, could you test and tell me if it fixs the build for you?

tchoutri commented 2 years ago

I'm a weird a Cabal Moment™ where despite being on the latest index timestamp I cannot seem to make Cabal pick 0.11.0.0, so I've sourced the package from the Git repo.

I'm happy to report that this new release works well! :)

guibou commented 2 years ago

Thank you. I'm closing the bug. I'll be happy to hear news about the new error reporting mecanisms, if you are happy or see possible improvements.