summaryrefslogtreecommitdiff
path: root/testsuite/tests/partial-sigs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2018-07-04 15:17:54 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2018-07-05 10:44:23 +0100
commit45f44e2c9d5db2f25c52abb402f197c20579400f (patch)
treef2d09ea5cfa5d0c414e9bff8592595081d2610aa /testsuite/tests/partial-sigs
parent14dfdf6a0a3364e2d3ae6f6839ef65bb24df4ebf (diff)
downloadhaskell-45f44e2c9d5db2f25c52abb402f197c20579400f.tar.gz
Refactor validity checking for constraints
There are several changes here. * TcInteract has gotten too big, so I moved all the class-instance matching out of TcInteract into a new module ClsInst. It parallels the FamInst module. The main export of ClsInst is matchGlobalInst. This now works in TcM not TcS. * A big reason to make matchGlobalInst work in TcM is that we can then use it from TcValidity.checkSimplifiableClassConstraint. That extends checkSimplifiableClassConstraint to work uniformly for built-in instances, which means that we now get a warning if we have givens (Typeable x, KnownNat n); see Trac #15322. * This change also made me refactor LookupInstResult, in particular by adding the InstanceWhat field. I also changed the name of the type to ClsInstResult. Then instead of matchGlobalInst reporting a staging error (which is inappropriate for the call from TcValidity), we can do so in TcInteract.checkInstanceOK. * In TcValidity, we now check quantified constraints for termination. For example, this signature should be rejected: f :: (forall a. Eq (m a) => Eq (m a)) => blah as discussed in Trac #15316. The main change here is that TcValidity.check_pred_help now uses classifyPredType, and has a case for ForAllPred which it didn't before. This had knock-on refactoring effects in TcValidity.
Diffstat (limited to 'testsuite/tests/partial-sigs')
-rw-r--r--testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr4
1 files changed, 2 insertions, 2 deletions
diff --git a/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr b/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr
index 4b72ec4520..262b76d60a 100644
--- a/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr
+++ b/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr
@@ -7,8 +7,8 @@ Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3,
integer-gmp-1.0.2.0]
SomethingShowable.hs:5:1: warning: [-Wsimplifiable-class-constraints (in -Wdefault)]
- • The constraint ‘Show Bool’ matches an instance declaration
- instance Show Bool -- Defined in ‘GHC.Show’
+ • The constraint ‘Show Bool’ matches
+ instance Show Bool -- Defined in ‘GHC.Show’
This makes type inference for inner bindings fragile;
either use MonoLocalBinds, or simplify it using the instance
• When checking the inferred type