jstolarek / ghc

Mirror of ghc repository. DO NOT SUBMIT PULL REQUESTS HERE
http://www.haskell.org/ghc/
Other
0 stars 0 forks source link

Better error location for associated type defaults #141

Closed jstolarek closed 9 years ago

jstolarek commented 9 years ago

I say:

class C a b where
    type FC a (b :: *) = r | r -> b
    type instance FC a b = b

instance C Char a

and GHC responds:

T6018.hs:1:1:
    Type family equation violates injectivity annotation.
    RHS of injective type family equation is a bare type variable
    but these LHS type and kind patterns are not bare variables: ‘Char’
      FC Char a -- Defined in ‘T6018’

That error location is not at all helpful. Can I report it at the instance declaration site?

jstolarek commented 9 years ago

The fix should go to TcInstDcls, line 576. I should mail GHC devs to ask if it is a good idea to add location to automatically generated things.