[commit: ghc] master: Accommodate API change in transSuperClasses (4293a80)

git at git.haskell.org git at git.haskell.org
Thu Aug 23 11:29:51 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/4293a80a3ea835412737911bcb2a6703e9af378b/ghc

>---------------------------------------------------------------

commit 4293a80a3ea835412737911bcb2a6703e9af378b
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Aug 23 09:22:42 2018 +0100

    Accommodate API change in transSuperClasses
    
    In this patch
    
        commit 6eabb6ddb7c53784792ee26b1e0657bde7eee7fb
        Author: Simon Peyton Jones <simonpj at microsoft.com>
        Date:   Tue Dec 15 14:26:13 2015 +0000
    
        Allow recursive (undecidable) superclasses
    
    I changed (transSuperClasses p) to return only the
    superclasses of p, but not p itself. (Previously it always
    returned p as well.)
    
    The use of transSuperClasses in TcErrors.warnRedundantConstraints
    really needs 'p' in the result -- but I faild to fix this
    call site, and instead crippled the test for Trac #10100.
    
    This patch sets things right
    
    * Accomodates the API change
    * Re-enables T10100
    * And thereby fixes Trac #11474


>---------------------------------------------------------------

4293a80a3ea835412737911bcb2a6703e9af378b
 compiler/typecheck/TcErrors.hs                     | 6 +++---
 testsuite/tests/typecheck/should_compile/T10100.hs | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs
index 7ef0754..06b660f 100644
--- a/compiler/typecheck/TcErrors.hs
+++ b/compiler/typecheck/TcErrors.hs
@@ -467,14 +467,14 @@ warnRedundantConstraints ctxt env info ev_vars
    redundant_evs =
        filterOut is_type_error $
        case info of -- See Note [Redundant constraints in instance decls]
-         InstSkol -> filterOut improving ev_vars
+         InstSkol -> filterOut (improving . idType) ev_vars
          _        -> ev_vars
 
    -- See #15232
    is_type_error = isJust . userTypeError_maybe . idType
 
-   improving ev_var = any isImprovementPred $
-                      transSuperClasses (idType ev_var)
+   improving pred -- (transSuperClasses p) does not include p
+     = any isImprovementPred (pred : transSuperClasses pred)
 
 reportBadTelescope :: ReportErrCtxt -> TcLclEnv -> Maybe SDoc -> [TcTyVar] -> TcM ()
 reportBadTelescope ctxt env (Just telescope) skols
diff --git a/testsuite/tests/typecheck/should_compile/T10100.hs b/testsuite/tests/typecheck/should_compile/T10100.hs
index 031be76..b88803c 100644
--- a/testsuite/tests/typecheck/should_compile/T10100.hs
+++ b/testsuite/tests/typecheck/should_compile/T10100.hs
@@ -2,7 +2,6 @@
 {-# LANGUAGE FunctionalDependencies #-}
 {-# LANGUAGE FlexibleInstances      #-}
 {-# LANGUAGE UndecidableInstances   #-}
-{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
 
 module T10100 where
 



More information about the ghc-commits mailing list