Fix #14934 by including axSub0R in typeNatCoAxiomRules
authorRyan Scott <ryan.gl.scott@gmail.com>
Mon, 19 Mar 2018 16:05:36 +0000 (12:05 -0400)
committerBen Gamari <ben@smart-cactus.org>
Mon, 19 Mar 2018 16:05:37 +0000 (12:05 -0400)
commitc3aea39678398fdf88166f30f0d01225a1874a32
tree48b6f02c0f17d0093c0675418b1f985e115073fa
parente3588547686348876b2bf27e7389fd00e51521bb
Fix #14934 by including axSub0R in typeNatCoAxiomRules

For some reason, `axSub0R` was left out of `typeNatCoAxiomRules` in
`TcTypeNats`, which led to disaster when trying to look up `Sub0R` from
an interface file, as demonstrated in #14934.

The fix is simple—just add `axSub0R` to that list. To help prevent
an issue like this happening in the future, I added a
`Note [Adding built-in type families]` to `TcTypeNats`, which
contains a walkthrough of all the definitions in `TcTypeNats` you
need to update when adding a new built-in type family.

Test Plan: make test TEST=T14934

Reviewers: bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #14934

Differential Revision: https://phabricator.haskell.org/D4508
compiler/iface/TcIface.hs
compiler/typecheck/TcTypeNats.hs
testsuite/tests/typecheck/should_compile/Makefile
testsuite/tests/typecheck/should_compile/T14934.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/T14934a.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/all.T