summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types
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
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')
-rw-r--r--testsuite/tests/indexed-types/should_compile/T11361a.stderr2
-rw-r--r--testsuite/tests/indexed-types/should_fail/SimpleFail4.stderr2
-rw-r--r--testsuite/tests/indexed-types/should_fail/T13971.stderr2
-rw-r--r--testsuite/tests/indexed-types/should_fail/T13971b.stderr2
-rw-r--r--testsuite/tests/indexed-types/should_fail/T16110_Fail2.stderr2
-rw-r--r--testsuite/tests/indexed-types/should_fail/T16110_Fail3.stderr2
-rw-r--r--testsuite/tests/indexed-types/should_fail/T16356_Fail1.stderr2
-rw-r--r--testsuite/tests/indexed-types/should_fail/T16356_Fail2.stderr2
-rw-r--r--testsuite/tests/indexed-types/should_fail/T18648.hs10
-rw-r--r--testsuite/tests/indexed-types/should_fail/T18648.stderr14
-rw-r--r--testsuite/tests/indexed-types/should_fail/all.T1
11 files changed, 33 insertions, 8 deletions
diff --git a/testsuite/tests/indexed-types/should_compile/T11361a.stderr b/testsuite/tests/indexed-types/should_compile/T11361a.stderr
index a7d5ad16af..ae2b832380 100644
--- a/testsuite/tests/indexed-types/should_compile/T11361a.stderr
+++ b/testsuite/tests/indexed-types/should_compile/T11361a.stderr
@@ -1,7 +1,7 @@
T11361a.hs:7:3: error:
• Illegal argument ‘*’ in:
- ‘type F @(*) x = x’
+ ‘type F @(*) x = ...’
The arguments to ‘F’ must all be distinct type variables
• In the default type instance declaration for ‘F’
In the class declaration for ‘C’
diff --git a/testsuite/tests/indexed-types/should_fail/SimpleFail4.stderr b/testsuite/tests/indexed-types/should_fail/SimpleFail4.stderr
index b791ea7d82..d23b24d824 100644
--- a/testsuite/tests/indexed-types/should_fail/SimpleFail4.stderr
+++ b/testsuite/tests/indexed-types/should_fail/SimpleFail4.stderr
@@ -1,7 +1,7 @@
SimpleFail4.hs:10:3: error:
• Illegal argument ‘Int’ in:
- ‘type S2 Int = Char’
+ ‘type S2 Int = ...’
The arguments to ‘S2’ must all be distinct type variables
• In the default type instance declaration for ‘S2’
In the class declaration for ‘C2’
diff --git a/testsuite/tests/indexed-types/should_fail/T13971.stderr b/testsuite/tests/indexed-types/should_fail/T13971.stderr
index fe4ab4ca3c..2c46366295 100644
--- a/testsuite/tests/indexed-types/should_fail/T13971.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T13971.stderr
@@ -1,7 +1,7 @@
T13971.hs:7:3: error:
• Illegal argument ‘*’ in:
- ‘type T @{k} @(*) a = Int’
+ ‘type T @{k} @(*) a = ...’
The arguments to ‘T’ must all be distinct type variables
• In the default type instance declaration for ‘T’
In the class declaration for ‘C’
diff --git a/testsuite/tests/indexed-types/should_fail/T13971b.stderr b/testsuite/tests/indexed-types/should_fail/T13971b.stderr
index cf64125fbb..afbd15d028 100644
--- a/testsuite/tests/indexed-types/should_fail/T13971b.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T13971b.stderr
@@ -1,7 +1,7 @@
T13971b.hs:9:3: error:
• Illegal duplicate variable ‘k’ in:
- ‘type T @k @k a b = k’
+ ‘type T @k @k a b = ...’
The arguments to ‘T’ must all be distinct type variables
• In the default type instance declaration for ‘T’
In the class declaration for ‘C’
diff --git a/testsuite/tests/indexed-types/should_fail/T16110_Fail2.stderr b/testsuite/tests/indexed-types/should_fail/T16110_Fail2.stderr
index caa46af46a..b901c28926 100644
--- a/testsuite/tests/indexed-types/should_fail/T16110_Fail2.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T16110_Fail2.stderr
@@ -1,7 +1,7 @@
T16110_Fail2.hs:9:3: error:
• Illegal duplicate variable ‘b’ in:
- ‘type T a b b = Int’
+ ‘type T a b b = ...’
The arguments to ‘T’ must all be distinct type variables
• In the default type instance declaration for ‘T’
In the class declaration for ‘C’
diff --git a/testsuite/tests/indexed-types/should_fail/T16110_Fail3.stderr b/testsuite/tests/indexed-types/should_fail/T16110_Fail3.stderr
index 0fdea6a63a..a84cf1a95f 100644
--- a/testsuite/tests/indexed-types/should_fail/T16110_Fail3.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T16110_Fail3.stderr
@@ -1,7 +1,7 @@
T16110_Fail3.hs:11:3: error:
• Illegal argument ‘Int’ in:
- ‘type T a Int = Int’
+ ‘type T a Int = ...’
The arguments to ‘T’ must all be distinct type variables
• In the default type instance declaration for ‘T’
In the class declaration for ‘C’
diff --git a/testsuite/tests/indexed-types/should_fail/T16356_Fail1.stderr b/testsuite/tests/indexed-types/should_fail/T16356_Fail1.stderr
index 74935362b6..ce246c59fd 100644
--- a/testsuite/tests/indexed-types/should_fail/T16356_Fail1.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T16356_Fail1.stderr
@@ -1,7 +1,7 @@
T16356_Fail1.hs:10:3: error:
• Illegal argument ‘*’ in:
- ‘type T @(*) a = Maybe a’
+ ‘type T @(*) a = ...’
The arguments to ‘T’ must all be distinct type variables
• In the default type instance declaration for ‘T’
In the class declaration for ‘C’
diff --git a/testsuite/tests/indexed-types/should_fail/T16356_Fail2.stderr b/testsuite/tests/indexed-types/should_fail/T16356_Fail2.stderr
index 37f8159ae0..3b1644d494 100644
--- a/testsuite/tests/indexed-types/should_fail/T16356_Fail2.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T16356_Fail2.stderr
@@ -1,7 +1,7 @@
T16356_Fail2.hs:8:3: error:
• Illegal duplicate variable ‘k’ in:
- ‘type T @k @k a b = k’
+ ‘type T @k @k a b = ...’
The arguments to ‘T’ must all be distinct type variables
• In the default type instance declaration for ‘T’
In the class declaration for ‘C’
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
diff --git a/testsuite/tests/indexed-types/should_fail/T18648.stderr b/testsuite/tests/indexed-types/should_fail/T18648.stderr
new file mode 100644
index 0000000000..0fbb014b50
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_fail/T18648.stderr
@@ -0,0 +1,14 @@
+
+T18648.hs:6:4: error:
+ • Illegal argument ‘f a’ in:
+ ‘type Bar1 (f a) = ...’
+ The arguments to ‘Bar1’ must all be distinct type variables
+ • In the default type instance declaration for ‘Bar1’
+ In the class declaration for ‘Foo1’
+
+T18648.hs:10:4: error:
+ • Illegal argument ‘Bar2 a’ in:
+ ‘type Bar2 (Bar2 a) = ...’
+ The arguments to ‘Bar2’ must all be distinct type variables
+ • In the default type instance declaration for ‘Bar2’
+ In the class declaration for ‘Foo2’
diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T
index a419610f9e..428ab8d4f1 100644
--- a/testsuite/tests/indexed-types/should_fail/all.T
+++ b/testsuite/tests/indexed-types/should_fail/all.T
@@ -162,3 +162,4 @@ test('T16356_Fail3', normal, compile_fail, [''])
test('T17008a', normal, compile_fail, ['-fprint-explicit-kinds'])
test('T13571', normal, compile_fail, [''])
test('T13571a', normal, compile_fail, [''])
+test('T18648', normal, compile_fail, [''])