From: simonmar@microsoft.com Date: Thu, 28 Jun 2007 08:11:05 +0000 (+0000) Subject: Fix typechecking bug with implicit parameters (Trac #1445) X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=52dead8037b16f86a60b4af234d1cf86dba9cee2 Fix typechecking bug with implicit parameters (Trac #1445) tcSplitFunTy_maybe wasn't dealing with types like (?x::Bool) => Int Here, tcSplitFunTy_maybe should fail (as it would if there was a for-all), because the type is a quantified type. See Trac #1445, and test tc230. --- diff --git a/compiler/typecheck/TcType.lhs b/compiler/typecheck/TcType.lhs index 5928630..01796c3 100644 --- a/compiler/typecheck/TcType.lhs +++ b/compiler/typecheck/TcType.lhs @@ -715,9 +715,16 @@ tcSplitFunTys ty = case tcSplitFunTy_maybe ty of (args,res') = tcSplitFunTys res tcSplitFunTy_maybe :: Type -> Maybe (Type, Type) -tcSplitFunTy_maybe ty | Just ty' <- tcView ty = tcSplitFunTy_maybe ty' -tcSplitFunTy_maybe (FunTy arg res) = Just (arg, res) -tcSplitFunTy_maybe other = Nothing +tcSplitFunTy_maybe ty | Just ty' <- tcView ty = tcSplitFunTy_maybe ty' +tcSplitFunTy_maybe (FunTy arg res) | not (isPredTy arg) = Just (arg, res) +tcSplitFunTy_maybe other = Nothing + -- Note the (not (isPredTy arg)) guard + -- Consider (?x::Int) => Bool + -- We don't want to treat this as a function type! + -- A concrete example is test tc230: + -- f :: () -> (?p :: ()) => () -> () + -- + -- g = f () () tcSplitFunTysN :: TcRhoType