From: simonpj@microsoft.com Date: Tue, 25 Nov 2008 11:05:40 +0000 (+0000) Subject: Fix Trac #2799: TcType.isOverloadedTy X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=524207589f410be34a7eec942e112739eb1519f8 Fix Trac #2799: TcType.isOverloadedTy A missing case (for equality predicates) in isOverloadedTy make bindInstsOfLocalFuns/Pats do the wrong thing. Core Lint nailed it. Merge to 6.10 branch. --- diff --git a/compiler/typecheck/TcType.lhs b/compiler/typecheck/TcType.lhs index fe5ea39..e0e7649 100644 --- a/compiler/typecheck/TcType.lhs +++ b/compiler/typecheck/TcType.lhs @@ -965,10 +965,13 @@ isSigmaTy (FunTy a _) = isPredTy a isSigmaTy _ = False isOverloadedTy :: Type -> Bool +-- Yes for a type of a function that might require evidence-passing +-- Used only by bindInstsOfLocalFuns/Pats +-- NB: be sure to check for type with an equality predicate; hence isCoVar isOverloadedTy ty | Just ty' <- tcView ty = isOverloadedTy ty' -isOverloadedTy (ForAllTy _ ty) = isOverloadedTy ty -isOverloadedTy (FunTy a _) = isPredTy a -isOverloadedTy _ = False +isOverloadedTy (ForAllTy tv ty) = isCoVar tv || isOverloadedTy ty +isOverloadedTy (FunTy a _) = isPredTy a +isOverloadedTy _ = False isPredTy :: Type -> Bool -- Belongs in TcType because it does -- not look through newtypes, or predtypes (of course)