From b83160d07e626bee685f329a9a73e90a4a6074ae Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Thu, 30 Apr 2015 09:18:49 +0100 Subject: Tidy up treatment of FlexibleContexts Previously (Trac #10351) we could get Non type-variable argument in the constraint: C [t] (Use FlexibleContexts to permit this) When checking that `f' has the inferred type f :: forall t. C [t] => t -> () which is a bit stupid: we have *inferred* a type that we immediately *reject*. This patch arranges that that the generalisation mechanism (TcSimplify.decideQuantification) doesn't pick a predicate that will be rejected by the subsequent validity check. This forced some minor refactoring, as usual. --- testsuite/tests/typecheck/should_fail/T10351.hs | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 testsuite/tests/typecheck/should_fail/T10351.hs (limited to 'testsuite/tests/typecheck/should_fail/T10351.hs') diff --git a/testsuite/tests/typecheck/should_fail/T10351.hs b/testsuite/tests/typecheck/should_fail/T10351.hs new file mode 100644 index 0000000000..411698b397 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T10351.hs @@ -0,0 +1,6 @@ +module T10351 where + +class C a where + op :: a -> () + +f x = op [x] -- cgit v1.2.1