Check for mismatched class methods during typechecking
Summary: Template Haskell provides a wormhole through which you can sneak methods that don't belong to a class into an instance for that class, bypassing the renamer's validity checks. The solution adopted here is to mirror the treatment for associated type family instances, which have an additional check in the typechecker which catch mismatched associated type families that were snuck through using Template Haskell. I've put a similar check for class methods into `tcMethods`. Test Plan: make test TEST=T12387 Reviewers: bgamari, simonpj Reviewed By: bgamari, simonpj Subscribers: simonpj, rwbarton, thomie, carter GHC Trac Issues: #12387 Differential Revision: https://phabricator.haskell.org/D4710
Showing
- compiler/hsSyn/HsUtils.hs 1 addition, 1 deletioncompiler/hsSyn/HsUtils.hs
- compiler/rename/RnEnv.hs 4 additions, 2 deletionscompiler/rename/RnEnv.hs
- compiler/typecheck/TcInstDcls.hs 37 additions, 0 deletionscompiler/typecheck/TcInstDcls.hs
- compiler/typecheck/TcValidity.hs 2 additions, 0 deletionscompiler/typecheck/TcValidity.hs
- testsuite/tests/th/T12387.hs 10 additions, 0 deletionstestsuite/tests/th/T12387.hs
- testsuite/tests/th/T12387.stderr 4 additions, 0 deletionstestsuite/tests/th/T12387.stderr
- testsuite/tests/th/all.T 1 addition, 0 deletionstestsuite/tests/th/all.T
Loading
Please register or sign in to comment