[Git][ghc/ghc][wip/T18932] PmCheck: Print types of uncovered patterns (#18932)

Sebastian Graf gitlab at gitlab.haskell.org
Wed Nov 18 12:53:52 UTC 2020



Sebastian Graf pushed to branch wip/T18932 at Glasgow Haskell Compiler / GHC


Commits:
9667ab7d by Sebastian Graf at 2020-11-18T13:53:43+01:00
PmCheck: Print types of uncovered patterns (#18932)

In order to avoid confusion as in #18932, we display the type of the
match variables in the non-exhaustiveness warning, e.g.

```
T18932.hs:14:1: warning: [-Wincomplete-patterns]
    Pattern match(es) are non-exhaustive
    In an equation for ‘g’:
        Patterns of type  ‘T a’, ‘T a’, ‘T a’ not matched:
            (MkT2 _) (MkT1 _) (MkT1 _)
            (MkT2 _) (MkT1 _) (MkT2 _)
            (MkT2 _) (MkT2 _) (MkT1 _)
            (MkT2 _) (MkT2 _) (MkT2 _)
            ...
   |
14 | g (MkT1 x) (MkT1 _) (MkT1 _) = x
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

It also allows us to omit the type signature on wildcard matches which
we previously showed in only some situations, particularly
`-XEmptyCase`.

Fixes #18932.

- - - - -


30 changed files:

- compiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Pmc/Ppr.hs
- testsuite/tests/deSugar/should_compile/DsStrictWarn.stderr
- testsuite/tests/deSugar/should_compile/GadtOverlap.stderr
- testsuite/tests/deSugar/should_compile/T14135.stderr
- testsuite/tests/deSugar/should_compile/T14546a.stderr
- testsuite/tests/deSugar/should_compile/T14546d.stderr
- testsuite/tests/deSugar/should_compile/T5455.stderr
- testsuite/tests/dependent/should_compile/KindEqualities.stderr
- testsuite/tests/driver/T8101.stderr
- testsuite/tests/driver/T8101b.stderr
- testsuite/tests/driver/werror.stderr
- testsuite/tests/ghci/prog018/prog018.stdout
- testsuite/tests/parser/should_compile/T15139.stderr
- testsuite/tests/pmcheck/complete_sigs/T13964.stderr
- testsuite/tests/pmcheck/complete_sigs/T14059a.stderr
- testsuite/tests/pmcheck/complete_sigs/T17386.stderr
- testsuite/tests/pmcheck/complete_sigs/completesig02.stderr
- testsuite/tests/pmcheck/complete_sigs/completesig04.stderr
- testsuite/tests/pmcheck/complete_sigs/completesig06.stderr
- testsuite/tests/pmcheck/complete_sigs/completesig07.stderr
- testsuite/tests/pmcheck/complete_sigs/completesig10.stderr
- testsuite/tests/pmcheck/complete_sigs/completesig11.stderr
- testsuite/tests/pmcheck/should_compile/EmptyCase001.stderr
- testsuite/tests/pmcheck/should_compile/EmptyCase002.stderr
- testsuite/tests/pmcheck/should_compile/EmptyCase003.stderr
- testsuite/tests/pmcheck/should_compile/EmptyCase004.stderr
- testsuite/tests/pmcheck/should_compile/EmptyCase005.stderr
- testsuite/tests/pmcheck/should_compile/EmptyCase006.stderr
- testsuite/tests/pmcheck/should_compile/EmptyCase007.stderr


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9667ab7d2fe7f115902003638a2a9e9a61576fb8

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9667ab7d2fe7f115902003638a2a9e9a61576fb8
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201118/dc80304d/attachment-0001.html>


More information about the ghc-commits mailing list