From 38d95c13fedc9966ee9731a69eef94d61cbba1d6 Mon Sep 17 00:00:00 2001
From: Simon Peyton Jones <simonpj@microsoft.com>
Date: Wed, 15 Aug 2012 16:02:03 +0100
Subject: [PATCH] Test FlexibleInstance not UndecidableInstances in the
 ambiguity check

Fixes Trac #7131

MERGED from commit f7b096e8630c91a17ff9a551ab15060b21d84eb0
---
 compiler/typecheck/TcMType.lhs | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/compiler/typecheck/TcMType.lhs b/compiler/typecheck/TcMType.lhs
index b59d1cb4df15..60bee0ba8041 100644
--- a/compiler/typecheck/TcMType.lhs
+++ b/compiler/typecheck/TcMType.lhs
@@ -1305,9 +1305,9 @@ Is every call to 'g' ambiguous?  After all, we might have
    intance C [a] where ...
 at the call site.  So maybe that type is ok!  Indeed even f's
 quintessentially ambiguous type might, just possibly be callable: 
-with -XUndecidableInstances we could have
+with -XFlexibleInstances we could have
   instance C a where ...
-and now a call could be legal after all!  (But only with  -XUndecidableInstances!)
+and now a call could be legal after all!  (But only with  -XFlexibleInstances!)
 
 What about things like this:
    class D a b | a -> b where ..
@@ -1333,7 +1333,7 @@ where
   * The constraints in 'Cambig' are all of form (C a b c) 
     where a,b,c are type variables
   * 'Cambig' is non-empty
-  * '-XUndecidableInstances' is not on.
+  * '-XFlexibleInstances' is not on.
 
 And that is what checkAmbiguity does.  See Trac #6134.
 
@@ -1375,8 +1375,8 @@ so we can take their type variables into account as part of the
 checkAmbiguity :: [TyVar] -> ThetaType -> TyVarSet -> TcM ()
 -- Note [The ambiguity check for type signatures]
 checkAmbiguity forall_tyvars theta tau_tyvars
-  = do { undecidable_instances <- xoptM Opt_UndecidableInstances
-       ; unless undecidable_instances $
+  = do { flexible_instances <- xoptM Opt_FlexibleInstances
+       ; unless flexible_instances $
          mapM_  ambigErr (filter is_ambig candidates) }
   where
 	-- See Note [Implicit parameters and ambiguity] in TcSimplify
-- 
GitLab