diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2019-03-17 09:37:27 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-03-20 20:10:57 -0400 |
commit | 8d18a873c5d7688c6e7d91efab6bb0d6f99393c6 (patch) | |
tree | 9d66f0b2647ebd968ab9ec6d2cc0debe900da9a0 /testsuite/tests/typecheck/should_fail/T12589.stderr | |
parent | 646e3dc20ebe25baae898a6b22895ddd015fc975 (diff) | |
download | haskell-8d18a873c5d7688c6e7d91efab6bb0d6f99393c6.tar.gz |
Reject nested predicates in impredicativity checking
When GHC attempts to unify a metavariable with a type containing
foralls, it will be rejected as an occurrence of impredicativity.
GHC was /not/ extending the same treatment to predicate types, such
as in the following (erroneous) example from #11514:
```haskell
foo :: forall a. (Show a => a -> a) -> ()
foo = undefined
```
This will attempt to instantiate `undefined` at
`(Show a => a -> a) -> ()`, which is impredicative. This patch
catches impredicativity arising from predicates in this fashion.
Since GHC is pickier about impredicative instantiations, some test
cases needed to be updated to be updated so as not to fall afoul of
the new validity check. (There were a surprising number of
impredicative uses of `undefined`!) Moreover, the `T14828` test case
now has slightly less informative types shown with `:print`. This is
due to a a much deeper issue with the GHCi debugger (see #14828).
Fixes #11514.
Diffstat (limited to 'testsuite/tests/typecheck/should_fail/T12589.stderr')
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T12589.stderr | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T12589.stderr b/testsuite/tests/typecheck/should_fail/T12589.stderr index 5e92f3af86..3f380e47a4 100644 --- a/testsuite/tests/typecheck/should_fail/T12589.stderr +++ b/testsuite/tests/typecheck/should_fail/T12589.stderr @@ -3,7 +3,7 @@ T12589.hs:13:3: error: Variable not in scope: (&) :: t1 -> t0 -> t T12589.hs:13:5: error: • Cannot instantiate unification variable ‘t0’ - with a type involving foralls: + with a type involving polytypes: (forall a. Bounded a => f0 a) -> h0 f0 xs0 GHC doesn't yet support impredicative polymorphism • In the second argument of ‘(&)’, namely ‘hcpure (Proxy @Bounded)’ |