Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : type-holes-branch
http://hackage.haskell.org/trac/ghc/changeset/b04a2f9153e7cecb6b0daaf25cd785626a0be069 >--------------------------------------------------------------- commit b04a2f9153e7cecb6b0daaf25cd785626a0be069 Author: Simon Peyton Jones <[email protected]> Date: Sat Sep 1 20:56:03 2012 +0100 Do not do escapeArrowScope when typechecking arrows The purpose of escapeArrowScope is to get the scopes right for arrows, and that is done in the renamer. Doing it in the typechecker as well messed up the level numbering for unification variables, triggering the ASSRET in isTouchableMetaTyVar. >--------------------------------------------------------------- compiler/rename/RnExpr.lhs | 5 +++++ compiler/typecheck/TcArrows.lhs | 18 ++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/compiler/rename/RnExpr.lhs b/compiler/rename/RnExpr.lhs index 78a6434..cbc57dc 100644 --- a/compiler/rename/RnExpr.lhs +++ b/compiler/rename/RnExpr.lhs @@ -331,6 +331,11 @@ rnExpr (HsArrApp arrow arg _ ho rtl) return (HsArrApp arrow' arg' placeHolderType ho rtl, fvArrow `plusFV` fvArg) where + -- See Note [Escaping the arrow scope] in TcRnTypes + -- Before renaming 'arrow', use the environment of the enclosing + -- proc for the (-<) case. + -- Local bindings, inside the enclosing proc, are not in scope + -- inside 'arrow'. In the higher-order case (-<<), they are. select_arrow_scope tc = case ho of HsHigherOrderApp -> tc HsFirstOrderApp -> escapeArrowScope tc diff --git a/compiler/typecheck/TcArrows.lhs b/compiler/typecheck/TcArrows.lhs index e15b2ad..3b627c9 100644 --- a/compiler/typecheck/TcArrows.lhs +++ b/compiler/typecheck/TcArrows.lhs @@ -159,19 +159,14 @@ tc_cmd env cmd@(HsArrApp fun arg _ ho_app lr) (cmd_stk, res_ty) do { arg_ty <- newFlexiTyVarTy openTypeKind ; let fun_ty = mkCmdArrTy env (foldl mkPairTy arg_ty cmd_stk) res_ty - ; fun' <- select_arrow_scope (tcMonoExpr fun fun_ty) + ; fun' <- tcMonoExpr fun fun_ty + -- No need for the escapeArrowScope stuff here + -- See Note [Escaping the arrow scope] in TcRnTypes ; arg' <- tcMonoExpr arg arg_ty ; return (HsArrApp fun' arg' fun_ty ho_app lr) } - where - -- Before type-checking f, use the environment of the enclosing - -- proc for the (-<) case. - -- Local bindings, inside the enclosing proc, are not in scope - -- inside f. In the higher-order case (-<<), they are. - select_arrow_scope tc = case ho_app of - HsHigherOrderApp -> tc - HsFirstOrderApp -> escapeArrowScope tc + ------------------------------------------- -- Command application @@ -258,7 +253,10 @@ tc_cmd env cmd@(HsArrForm expr fixity cmd_args) (cmd_stk, res_ty) -- Check expr ; (inst_binds, expr') <- checkConstraints ArrowSkol [w_tv] [] $ - escapeArrowScope (tcMonoExpr expr e_ty) + tcMonoExpr expr e_ty + -- No need for escapeArrowScope in the + -- type checker. + -- Note [Escaping the arrow scope] in TcRnTypes -- OK, now we are in a position to unscramble -- the s1..sm and check each cmd _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
