diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2013-05-30 12:33:56 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2013-05-30 14:03:49 +0100 |
commit | 936001caa0dc045aa937c9f256b338429664d83c (patch) | |
tree | 4505ff46f801d6c3f3d34b91bd78653dd61ca7f0 | |
parent | 8d49ef16c84b444592b6b234b6c97be047622df8 (diff) | |
download | haskell-936001caa0dc045aa937c9f256b338429664d83c.tar.gz |
Improve validity check to give better error message
Fixes Trac #7809
-rw-r--r-- | compiler/typecheck/TcValidity.lhs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/typecheck/TcValidity.lhs b/compiler/typecheck/TcValidity.lhs index e232598ea2..54377192f4 100644 --- a/compiler/typecheck/TcValidity.lhs +++ b/compiler/typecheck/TcValidity.lhs @@ -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 @@ -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 |