[commit: ghc] master: Remove code reporting issues with Safe Haskell and coerce. (7602bd4)
git at git.haskell.org
git at git.haskell.org
Fri Mar 14 19:04:34 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/7602bd4de901e4304a3a45dca08fc630d1bb5bf2/ghc
>---------------------------------------------------------------
commit 7602bd4de901e4304a3a45dca08fc630d1bb5bf2
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date: Fri Mar 14 15:03:21 2014 -0400
Remove code reporting issues with Safe Haskell and coerce.
This is a followup to the fix for #8827, and should be merged
with that change.
>---------------------------------------------------------------
7602bd4de901e4304a3a45dca08fc630d1bb5bf2
compiler/typecheck/TcErrors.lhs | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/compiler/typecheck/TcErrors.lhs b/compiler/typecheck/TcErrors.lhs
index 4b1bc68..df241c9 100644
--- a/compiler/typecheck/TcErrors.lhs
+++ b/compiler/typecheck/TcErrors.lhs
@@ -996,9 +996,8 @@ mk_dict_err ctxt (ct, (matches, unifiers, safe_haskell))
= do { let (is_ambig, ambig_msg) = mkAmbigMsg ct
; (ctxt, binds_msg) <- relevantBindings True ctxt ct
; traceTc "mk_dict_err" (ppr ct $$ ppr is_ambig $$ ambig_msg)
- ; safe_mod <- safeLanguageOn `fmap` getDynFlags
; rdr_env <- getGlobalRdrEnv
- ; return (ctxt, cannot_resolve_msg safe_mod rdr_env is_ambig binds_msg ambig_msg) }
+ ; return (ctxt, cannot_resolve_msg rdr_env is_ambig binds_msg ambig_msg) }
| not safe_haskell -- Some matches => overlap errors
= return (ctxt, overlap_msg)
@@ -1013,8 +1012,8 @@ mk_dict_err ctxt (ct, (matches, unifiers, safe_haskell))
givens = getUserGivens ctxt
all_tyvars = all isTyVarTy tys
- cannot_resolve_msg safe_mod rdr_env has_ambig_tvs binds_msg ambig_msg
- = vcat [ addArising orig (no_inst_msg $$ coercible_explanation safe_mod rdr_env)
+ cannot_resolve_msg rdr_env has_ambig_tvs binds_msg ambig_msg
+ = vcat [ addArising orig (no_inst_msg $$ coercible_explanation rdr_env)
, vcat (pp_givens givens)
, ppWhen (has_ambig_tvs && not (null unifiers && null givens))
(vcat [ ambig_msg, binds_msg, potential_msg ])
@@ -1139,27 +1138,12 @@ mk_dict_err ctxt (ct, (matches, unifiers, safe_haskell))
-- This function tries to reconstruct why a "Coercible ty1 ty2" constraint
-- is left over. Therefore its logic has to stay in sync with
-- getCoericbleInst in TcInteract. See Note [Coercible Instances]
- coercible_explanation safe_mod rdr_env
+ coercible_explanation rdr_env
| clas /= coercibleClass = empty
| Just (tc1,tyArgs1) <- splitTyConApp_maybe ty1,
Just (tc2,tyArgs2) <- splitTyConApp_maybe ty2,
tc1 == tc2
= nest 2 $ vcat $
- -- Only for safe haskell: First complain if tc is abstract, only if
- -- not check if the type constructors therein are abstract
- (if safe_mod
- then case tyConAbstractMsg rdr_env tc1 empty of
- Just msg ->
- [ msg $$ ptext (sLit "as required in SafeHaskell mode") ]
- Nothing ->
- [ msg
- | tc <- tyConsOfTyCon tc1
- , Just msg <- return $
- tyConAbstractMsg rdr_env tc $
- parens $ ptext (sLit "used within") <+> quotes (ppr tc1)
- ]
- else []
- ) ++
[ fsep [ hsep [ ptext $ sLit "because the", speakNth n, ptext $ sLit "type argument"]
, hsep [ ptext $ sLit "of", quotes (ppr tc1), ptext $ sLit "has role Nominal,"]
, ptext $ sLit "but the arguments"
More information about the ghc-commits
mailing list