From 524207589f410be34a7eec942e112739eb1519f8 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Tue, 25 Nov 2008 11:05:40 +0000 Subject: [PATCH] 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. --- compiler/typecheck/TcType.lhs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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) -- 1.7.10.4