From: simonpj Date: Thu, 3 May 2001 09:04:43 +0000 (+0000) Subject: [project @ 2001-05-03 09:04:43 by simonpj] X-Git-Tag: Approximately_9120_patches~2015 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=0f7c4b885e64428f50e9fa943ecd42d3c5f39c35;p=ghc-hetmet.git [project @ 2001-05-03 09:04:43 by simonpj] Improve error message when two signature tyvars get unified --- diff --git a/ghc/compiler/typecheck/TcMonoType.lhs b/ghc/compiler/typecheck/TcMonoType.lhs index 0e622a0..9308390 100644 --- a/ghc/compiler/typecheck/TcMonoType.lhs +++ b/ghc/compiler/typecheck/TcMonoType.lhs @@ -821,15 +821,17 @@ checkSigTyVars sig_tyvars free_tyvars -- acc maps a zonked type variable back to a signature type variable = case getTyVar_maybe ty of { Nothing -> -- Error (a)! - returnNF_Tc (tidy_env, acc, unify_msg sig_tyvar (ppr ty) : msgs) ; + returnNF_Tc (tidy_env, acc, unify_msg sig_tyvar (quotes (ppr ty)) : msgs) ; Just tv -> case lookupVarEnv acc tv of { Just sig_tyvar' -> -- Error (b) or (d)! - returnNF_Tc (tidy_env, acc, unify_msg sig_tyvar (ppr sig_tyvar') : msgs) ; + returnNF_Tc (tidy_env, acc, unify_msg sig_tyvar thing : msgs) + where + thing = ptext SLIT("another quantified type variable") <+> quotes (ppr sig_tyvar') - Nothing -> + ; Nothing -> if tv `elemVarSet` globals -- Error (c)! Type variable escapes -- The least comprehensible, so put it last @@ -913,7 +915,7 @@ escape_msg sig_tv tv globs frees vcat_first 0 (x:xs) = text "...others omitted..." vcat_first n (x:xs) = x $$ vcat_first (n-1) xs -unify_msg tv thing = mk_msg tv <+> ptext SLIT("is unified with") <+> quotes thing +unify_msg tv thing = mk_msg tv <+> ptext SLIT("is unified with") <+> thing mk_msg tv = ptext SLIT("Quantified type variable") <+> quotes (ppr tv) \end{code}