summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_fail/T18648.hs
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-09-08 07:20:02 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-09 00:46:41 -0400
commit822f10575d207a2a47b21ac853dcf28c655041c4 (patch)
tree73fed8f93e7b3b46d880e6088fb415c1332bc80d /testsuite/tests/indexed-types/should_fail/T18648.hs
parente5a2899ce8e06b8645946fbb67041807cd3a4fe5 (diff)
downloadhaskell-822f10575d207a2a47b21ac853dcf28c655041c4.tar.gz
Postpone associated tyfam default checks until after typechecking
Previously, associated type family defaults were validity-checked during typechecking. Unfortunately, the error messages that these checks produce run the risk of printing knot-tied type constructors, which will cause GHC to diverge. In order to preserve the current error message's descriptiveness, this patch postpones these validity checks until after typechecking, which are now located in the new function `GHC.Tc.Validity.checkValidAssocTyFamDeflt`. Fixes #18648.
Diffstat (limited to 'testsuite/tests/indexed-types/should_fail/T18648.hs')
-rw-r--r--testsuite/tests/indexed-types/should_fail/T18648.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_fail/T18648.hs b/testsuite/tests/indexed-types/should_fail/T18648.hs
new file mode 100644
index 0000000000..92502b77c8
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_fail/T18648.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE TypeFamilies #-}
+module T18648 where
+
+class Foo1 a where
+ type Bar1 a
+ type Bar1 (f a) = Bar1 a
+
+class Foo2 a where
+ type Bar2 a
+ type Bar2 (Bar2 a) = a