Don't warn when empty casing on Type
authorRyan Scott <ryan.gl.scott@gmail.com>
Sat, 5 Aug 2017 16:02:54 +0000 (12:02 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Sat, 5 Aug 2017 16:02:55 +0000 (12:02 -0400)
commita267580e4ab37115dcc33f3b8a9af67b9364da12
tree8cbea155ec76df9f91d44d03faa55e606f85b9cf
parenta81b5b0067b6530f5883aeb0154a407a54d14c62
Don't warn when empty casing on Type

Summary:
`Type` (a.k.a. `TYPE LiftedRep`) can be used at the type level thanks
to `TypeInType`. However, expressions like

```lang=haskell
f :: Type -> Int
f x = case x of {}
```

were falsely claiming that the empty case on the value of type `Type` was
non-exhaustive. The reason is a bit silly: `TYPE` is technically not an empty
datatype in GHC's eyes, since it's a builtin, primitive type. To convince the
pattern coverage checker otherwise, this adds a special case for `TYPE`.

Test Plan: make test TEST=T14086

Reviewers: gkaracha, austin, bgamari, goldfire

Reviewed By: goldfire

Subscribers: goldfire, rwbarton, thomie

GHC Trac Issues: #14086

Differential Revision: https://phabricator.haskell.org/D3819
compiler/deSugar/Check.hs
testsuite/tests/pmcheck/should_compile/T14086.hs [new file with mode: 0644]
testsuite/tests/pmcheck/should_compile/all.T