Bang pattern hint misdiagnosis with TemplateHaskell
Summary
This code:
module A1 where
(!) _ _ = return []
{-# LANGUAGE TemplateHaskell #-}
import A1
1!2
Results in this error:
A.hs:3:2: warning: [-Wmissing-space-after-bang]
Did you forget to enable BangPatterns?
If you mean to bind (!) then perhaps you want
to add a space after the bang for clarity.
|
3 | 1!2
|
But of course, this warning makes no sense – 1!2
is not an LHS here, it's a top-level TemplateHaskell expression.
Steps to reproduce
Create files A.hs
and A1.hs
described above and run ghci --interactive A.hs
. You will see the warning.
Expected behavior
No warning.
Environment
- GHC version used: 8.8-alpha, HEAD