Skip to content

Commit

Permalink
Improve validity check to give better error message
Browse files Browse the repository at this point in the history
Fixes Trac #7809
  • Loading branch information
Simon Peyton Jones committed May 30, 2013
1 parent 8d49ef1 commit 936001c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/typecheck/TcValidity.lhs
Expand Up @@ -305,7 +305,7 @@ check_syn_tc_app ctxt rank ty tc tys
; liberal <- xoptM Opt_LiberalTypeSynonyms
; if not liberal || isSynFamilyTyCon tc then
-- For H98 and synonym families, do check the type args
mapM_ (check_mono_type ctxt synArgMonoType) tys
mapM_ check_arg tys
else -- In the liberal case (only for closed syns), expand then check
case tcView ty of
Expand All @@ -314,13 +314,15 @@ check_syn_tc_app ctxt rank ty tc tys
| GhciCtxt <- ctxt -- Accept under-saturated type synonyms in
-- GHCi :kind commands; see Trac #7586
= mapM_ (check_mono_type ctxt synArgMonoType) tys
= mapM_ check_arg tys
| otherwise
= failWithTc (arityErr "Type synonym" (tyConName tc) tc_arity n_args)
where
n_args = length tys
tc_arity = tyConArity tc
check_arg | isSynFamilyTyCon tc = check_arg_type ctxt rank
| otherwise = check_mono_type ctxt synArgMonoType
----------------------------------------
check_ubx_tuple :: UserTypeCtxt -> KindOrType
Expand Down

0 comments on commit 936001c

Please sign in to comment.