Skip to content

Incorrect error message for a pragma on an invalid instance method.

Compiling this code

data Foo = Foo
instance Eq Foo where
  {-# INLINE wrong #-}
  wrong _ = True

I get these errors:

foo.hs:3:14: error:
    The INLINE pragma for ‘wrong’ lacks an accompanying binding
  |
3 |   {-# INLINE wrong #-}
  |              ^^^^^

foo.hs:4:3: error: ‘wrong’ is not a (visible) method of class ‘Eq’
  |
4 |   wrong _ = True
  |   ^^^^^

The first error I see is not really right. There is an accompanying binding, albeit a wrong one.

Of course, the next error shows what the actual problem is, so in practice this may not be a serious issue.

I tested this in GHC 8.6 and the alpha release of 8.8.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information