Test for type synonym loops on TyCon.
authorEdward Z. Yang <ezyang@cs.stanford.edu>
Sat, 29 Oct 2016 00:54:36 +0000 (17:54 -0700)
committerEdward Z. Yang <ezyang@cs.stanford.edu>
Thu, 17 Nov 2016 05:31:59 +0000 (21:31 -0800)
commit31398fbc6d9ee0bd95de64b08becc38faf188972
tree0ae632f650671447b96ce231781240b4d840097f
parentb76958671cda1df9f6f0e1d54d681144d09cb06e
Test for type synonym loops on TyCon.

Summary:
Previously, we tested for type synonym loops by doing
a syntactic test on the literal type synonym declarations.
However, in some cases, loops could go through hs-boot
files, leading to an infinite loop (#12042); a similar
situation can occur when signature merging.

This commit replaces the syntactic test with a test on
TyCon, simply by walking down all type synonyms until
we bottom out, or find we've looped back.  It's a lot
simpler.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, austin, bgamari

Subscribers: goldfire, thomie

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

GHC Trac Issues: #12042
22 files changed:
compiler/hsSyn/HsDecls.hs
compiler/typecheck/TcBackpack.hs
compiler/typecheck/TcBinds.hs
compiler/typecheck/TcTyClsDecls.hs
compiler/typecheck/TcTyDecls.hs
compiler/types/Type.hs
docs/users_guide/8.2.1-notes.rst
docs/users_guide/glasgow_exts.rst
testsuite/driver/extra_files.py
testsuite/tests/backpack/should_fail/all.T
testsuite/tests/backpack/should_fail/bkpfail29.bkp [new file with mode: 0644]
testsuite/tests/backpack/should_fail/bkpfail29.stderr [new file with mode: 0644]
testsuite/tests/module/mod27.stderr
testsuite/tests/typecheck/should_compile/all.T
testsuite/tests/typecheck/should_compile/tc268.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/tc269.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/tc270.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T12042.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T12042.hs-boot [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T12042.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T12042a.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T