Fix #14692 by correcting an off-by-one error in TcGenDeriv
authorRyan Scott <ryan.gl.scott@gmail.com>
Sun, 21 Jan 2018 17:06:06 +0000 (12:06 -0500)
committerBen Gamari <ben@smart-cactus.org>
Mon, 22 Jan 2018 03:25:41 +0000 (22:25 -0500)
commit1d05e0c74ad861946e4deb4f27a77b181cab3089
tree02b7e5893eae6f10e83dce819788677f334365b7
parentb75f8d2628a6db74254b34b2c9ca7aa22138e715
Fix #14692 by correcting an off-by-one error in TcGenDeriv

A silly mistake in `gen_Show_binds` was causing derived
`Show` instances for empty data types to case on the precedence
argument instead of the actual value being showed.

Test Plan: make test TEST=drv-empty-data

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14692

Differential Revision: https://phabricator.haskell.org/D4328

(cherry picked from commit 0074a08ea9dfd1416aa57a9504be73dcdf7a1e2b)
compiler/typecheck/TcGenDeriv.hs
testsuite/tests/deriving/should_compile/drv-empty-data.stderr