• Ryan Scott's avatar
    Reject nested predicates in impredicativity checking · 8d18a873
    Ryan Scott authored
    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.
    8d18a873
Name
Last commit
Last update
.circleci Loading commit data...
.gitlab Loading commit data...
bindisttest Loading commit data...
compiler Loading commit data...
distrib Loading commit data...
docs Loading commit data...
driver Loading commit data...
ghc Loading commit data...
hadrian Loading commit data...
includes Loading commit data...
libffi Loading commit data...
libffi-tarballs @ 96d02800 Loading commit data...
libraries Loading commit data...
mk Loading commit data...
nofib @ 7a702cc1 Loading commit data...
rts Loading commit data...
rules Loading commit data...
testsuite Loading commit data...
utils Loading commit data...
.appveyor.sh Loading commit data...
.ghcid Loading commit data...
.gitignore Loading commit data...
.gitlab-ci.yml Loading commit data...
.gitmodules Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
ANNOUNCE Loading commit data...
CODEOWNERS Loading commit data...
HACKING.md Loading commit data...
INSTALL.md Loading commit data...
LICENSE Loading commit data...
MAKEHELP.md Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
Vagrantfile Loading commit data...
aclocal.m4 Loading commit data...
appveyor.yml Loading commit data...
boot Loading commit data...
build.nix.sh Loading commit data...
config.guess Loading commit data...
config.sub Loading commit data...
configure.ac Loading commit data...
ghc.mk Loading commit data...
install-sh Loading commit data...
llvm-passes Loading commit data...
llvm-targets Loading commit data...
packages Loading commit data...
settings.in Loading commit data...
validate Loading commit data...