Add a recursivity check in nonVoid
authorRyan Scott <ryan.gl.scott@gmail.com>
Sun, 23 Sep 2018 12:15:13 +0000 (08:15 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Sun, 23 Sep 2018 12:15:13 +0000 (08:15 -0400)
commite68b439fe5de61b9a2ca51af472185c62ccb8b46
tree332f26c79fd4b5a4eab866abf69da113fba3295d
parent2dbf88b3558c3b53a1207fb504232c3da67b266e
Add a recursivity check in nonVoid

Summary:
Previously `nonVoid` outright refused to call itself
recursively to avoid the risk of hitting infinite loops when
checking recurisve types. But this is too conservative—we //can//
call `nonVoid` recursively as long as we incorporate a way to detect
the presence of recursive types, and bail out if we do detect one.
Happily, such a mechanism already exists in the form of `checkRecTc`,
so let's use it.

Test Plan: make test TEST=T15584

Reviewers: simonpj, bgamari

Reviewed By: simonpj

Subscribers: rwbarton, carter

GHC Trac Issues: #15584

Differential Revision: https://phabricator.haskell.org/D5116
compiler/deSugar/Check.hs
compiler/types/TyCon.hs
testsuite/tests/pmcheck/should_compile/T15584.hs [new file with mode: 0644]
testsuite/tests/pmcheck/should_compile/all.T