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/ghci.debugger | |
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/ghci.debugger')
-rw-r--r-- | testsuite/tests/ghci.debugger/scripts/print027.stdout | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/testsuite/tests/ghci.debugger/scripts/print027.stdout b/testsuite/tests/ghci.debugger/scripts/print027.stdout index 3117eace87..eb5b363693 100644 --- a/testsuite/tests/ghci.debugger/scripts/print027.stdout +++ b/testsuite/tests/ghci.debugger/scripts/print027.stdout @@ -1,6 +1,6 @@ -+ = (_t1::Num a => a -> a -> a) -print = (_t2::Show a1 => a1 -> IO ()) -log = (_t3::Floating a2 => a2 -> a2) -head = (_t4::[a4] -> a4) -tail = (_t5::[a7] -> [a7]) -fst = (_t6::(a11, b) -> a11) ++ = (_t1::t1) +print = (_t2::t1) +log = (_t3::t1) +head = (_t4::[a] -> a) +tail = (_t5::[a1] -> [a1]) +fst = (_t6::(a2, b) -> a2) |