diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2011-09-29 16:05:16 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2011-09-29 16:05:16 +0100 |
commit | 817d1b047b538e408a8758a18270c51d429de670 (patch) | |
tree | 8f9ccfa37ddb09b979ace6a3a10789b883348765 /compiler/hsSyn | |
parent | ba60fc61ba5bbac8d0bbeb719fe26daa4058e1c5 (diff) | |
download | haskell-817d1b047b538e408a8758a18270c51d429de670.tar.gz |
Fix scoping for RHS of associated type decls (fixes Trac #5515)
We should not allow things like
class C a b where
type F a :: *
instance C (p,q) r where
type F (p,q) = r -- No! fvs(rhs) should be a subset
-- of fvs(lhs)
Diffstat (limited to 'compiler/hsSyn')
-rw-r--r-- | compiler/hsSyn/HsDecls.lhs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/hsSyn/HsDecls.lhs b/compiler/hsSyn/HsDecls.lhs index 940e6a73c3..deb72edc96 100644 --- a/compiler/hsSyn/HsDecls.lhs +++ b/compiler/hsSyn/HsDecls.lhs @@ -532,9 +532,14 @@ tcdTyPats = Just tys This is a data/type family instance declaration tcdTyVars are fv(tys) - Eg instance C (a,b) where - type F a x y = x->y - After the renamer, the tcdTyVars of the F decl are {x,y} + Eg class C a b where + type F a x :: * + instance D p s => C (p,q) [r] where + type F (p,q) x = p -> x + The tcdTyVars of the F instance decl are {p,q,x}, + i.e. not including s, nor r + (and indeed neither s nor should be mentioned + on the RHS of the F instance decl; Trac #5515) ------------------------------ Simple classifiers |