dhall-lang / dhall-to-cabal

Compile Dhall expressions to Cabal files
MIT License
100 stars 19 forks source link

Weird -Woverlapping-patterns warnings #136

Closed quasicomputational closed 5 years ago

quasicomputational commented 5 years ago

I'm seeing warnings like these while building with GHC 8.4 and 8.6 both:

lib/DhallToCabal.hs:656:9: warning: [-Woverlapping-patterns]
    Pattern match is redundant
    In a case alternative: Expr.App "withinVersion" components -> ...
    |
656 |         Expr.App "withinVersion" components ->
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

lib/DhallToCabal.hs:659:9: warning: [-Woverlapping-patterns]
    Pattern match is redundant
    In a case alternative:
        Expr.App "majorBoundVersion" components -> ...
    |
659 |         Expr.App "majorBoundVersion" components ->
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

lib/DhallToCabal.hs:776:9: warning: [-Woverlapping-patterns]
    Pattern match is redundant
    In a case alternative: Expr.App (Expr.App "or" a) b -> ...
    |
776 |         Expr.App ( Expr.App "or" a ) b ->
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

Experimentally, I tried removing one of the complained-about cases, but that broke the tests, as I'd expected from looking at the code. GHC's pattern coverage checker is evidently drawing a false conclusion, but I'm not sure if it's somehow being led astray or if it's a legitimate compiler bug.

I can't find an obviously responsible ticket in GHC's trac that'd be causing this behaviour. Does anyone have a clue? If not, the next step is to try to minimise the example and verify that it's a GHC bug.

Also, I should note that I think they started with 88010864dfedada2d2efb11d190673cb3f546b24: I haven't bisected, but that's what git blame points to. I can't see anything obviously amiss about the commit, though.

quasicomputational commented 5 years ago

This is probably a GHC bug and so there's nothing for us to do. Reported it as https://ghc.haskell.org/trac/ghc/ticket/15713.

ocharles commented 5 years ago

Thanks for reporting this. I was surprised when I introduced these warnings but figured they superfluous and not actually problematic.

On Sat, 6 Oct 2018, 2:31 pm quasicomputational, notifications@github.com wrote:

Closed #136 https://github.com/dhall-lang/dhall-to-cabal/issues/136.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dhall-lang/dhall-to-cabal/issues/136#event-1888573577, or mute the thread https://github.com/notifications/unsubscribe-auth/AABRjg-KiHilu5GpGCBgOokcAUx44g8Wks5uiLDDgaJpZM4XKbBq .