Unhelpful error message for standalone deriving Eq instance
Summary
Adding the line
deriving instance Eq (HsMatchContext RdrName)
after the declaration for HsMatchContext
in Expr.hs
results
in an error, because there is no Eq
instance for RdrName
.
But the error is reported as
compiler/GHC/Hs/Expr.hs:2808:1: error:
• No instance for (Eq (HsStmtContext RdrName))
arising from a use of ‘==’
• In the expression: ((a1 == b1))
In an equation for ‘==’:
(==) (StmtCtxt a1) (StmtCtxt b1) = ((a1 == b1))
When typechecking the code for ‘==’
in a derived instance for ‘Eq (HsMatchContext RdrName)’:
To see the code I am typechecking, use -ddump-deriv
In the instance declaration for ‘Eq (HsMatchContext RdrName)’
|
2808 | deriving instance Eq (HsMatchContext RdrName)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expected behavior
I would expect it to report that RdrName
does not have an Eq
instance.
Environment
- GHC version used: 01c43634
(technically on my
wip/az/exactprint
branch, but nothing has changed which should affect this.
Optional:
- Operating System:
- System Architecture: