diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2021-08-21 00:42:00 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-10-05 03:19:14 -0400 |
commit | 298df16d7005a3cead2df1cc7280509ddf7c6c76 (patch) | |
tree | cc2d61fa24e649004ceb49f789e2086226795f68 /testsuite/tests | |
parent | 5601b9e249661a16f4bfb14958fe10d950e7e589 (diff) | |
download | haskell-298df16d7005a3cead2df1cc7280509ddf7c6c76.tar.gz |
Reject type family equation with wrong name (#20260)
We should reject "type family Foo where Bar = ()".
This check was done in kcTyFamInstEqn but not in tcTyFamInstEqn.
I factored out arity checking, which was duplicated.
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T20260.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T20260.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/all.T | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T20260.hs b/testsuite/tests/typecheck/should_fail/T20260.hs new file mode 100644 index 0000000000..1e828f9123 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T20260.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE TypeFamilies, StandaloneKindSignatures #-} +module T20260 where + +data Bar + +type Foo :: * +type family Foo where + Bar = () diff --git a/testsuite/tests/typecheck/should_fail/T20260.stderr b/testsuite/tests/typecheck/should_fail/T20260.stderr new file mode 100644 index 0000000000..574d72163d --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T20260.stderr @@ -0,0 +1,6 @@ + +T20260.hs:8:3: error: + • Mismatched type name in type family instance. + Expected: Foo + Actual: Bar + • In the type family declaration for ‘Foo’ diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 34ab2f2f7a..37bbc911b9 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -637,4 +637,5 @@ test('T19978', normal, compile_fail, ['']) test('T20043', normal, compile_fail, ['']) test('T20122', normal, compile_fail, ['']) test('T20241b', normal, compile_fail, ['']) +test('T20260', normal, compile_fail, ['']) test('OrdErr', normal, compile_fail, ['']) |