summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorsimonmar@microsoft.com <unknown>2007-06-28 08:11:05 +0000
committersimonmar@microsoft.com <unknown>2007-06-28 08:11:05 +0000
commit52dead8037b16f86a60b4af234d1cf86dba9cee2 (patch)
tree21a3ba888db710b520ff37a599a5a060f9ecf53c /compiler
parent1723d79af0638a1e96e2ae9e41208f7b86872bbc (diff)
downloadhaskell-52dead8037b16f86a60b4af234d1cf86dba9cee2.tar.gz
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.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/typecheck/TcType.lhs13
1 files changed, 10 insertions, 3 deletions
diff --git a/compiler/typecheck/TcType.lhs b/compiler/typecheck/TcType.lhs
index 59286304da..01796c385d 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