Repository : ssh://[email protected]/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e365d4963f1061878269502f256b4a56ca273a78/ghc
>--------------------------------------------------------------- commit e365d4963f1061878269502f256b4a56ca273a78 Author: Simon Peyton Jones <[email protected]> Date: Tue Sep 10 11:42:03 2013 +0100 Improve the insolubility check when quantifying See Note [Quantification with errors] Fixes Trac #8262 >--------------------------------------------------------------- e365d4963f1061878269502f256b4a56ca273a78 compiler/typecheck/TcSimplify.lhs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcSimplify.lhs b/compiler/typecheck/TcSimplify.lhs index b39bc85..0ffda04 100644 --- a/compiler/typecheck/TcSimplify.lhs +++ b/compiler/typecheck/TcSimplify.lhs @@ -247,8 +247,8 @@ simplifyInfer _top_lvl apply_mr name_taus wanteds -- constraint. ; ev_binds_var <- newTcEvBinds - ; wanted_transformed <- solveWantedsTcMWithEvBinds ev_binds_var wanteds $ - solve_wanteds_and_drop + ; wanted_transformed_incl_derivs + <- solveWantedsTcMWithEvBinds ev_binds_var wanteds solve_wanteds -- Post: wanted_transformed are zonked -- Step 4) Candidates for quantification are an approximation of wanted_transformed @@ -263,9 +263,11 @@ simplifyInfer _top_lvl apply_mr name_taus wanteds ; tc_lcl_env <- TcRnMonad.getLclEnv ; let untch = tcl_untch tc_lcl_env + wanted_transformed = dropDerivedWC wanted_transformed_incl_derivs ; quant_pred_candidates -- Fully zonked - <- if insolubleWC wanted_transformed + <- if insolubleWC wanted_transformed_incl_derivs then return [] -- See Note [Quantification with errors] + -- NB: must include derived errors else do { gbl_tvs <- tcGetGlobalTyVars ; let quant_cand = approximateWC wanted_transformed meta_tvs = filter isMetaTyVar (varSetElems (tyVarsOfCts quant_cand)) @@ -392,6 +394,10 @@ type we have found. For two reasons a) Minimise downstream errors b) Avoid spurious errors from this function +But NB that we must include *derived* errors in the check. Example: + (a::*) ~ Int# +We get an insoluble derived error *~#, and we don't want to discard +it before doing the isInsolubleWC test! (Trac #8262) Note [Default while Inferring] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -607,7 +613,7 @@ solveWantedsTcM wanted solve_wanteds_and_drop :: WantedConstraints -> TcS (WantedConstraints) -- Since solve_wanteds returns the residual WantedConstraints, --- it should alway be called within a runTcS or something similar, +-- it should always be called within a runTcS or something similar, solve_wanteds_and_drop wanted = do { wc <- solve_wanteds wanted ; return (dropDerivedWC wc) } _______________________________________________ ghc-commits mailing list [email protected] http://www.haskell.org/mailman/listinfo/ghc-commits
