diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-12-20 23:00:21 -0500 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-12-20 23:00:21 -0500 |
commit | 28f41f1a7a0ebae7b50ca41dbf78c04ee5b8b5b7 (patch) | |
tree | 6b67b7d02b2b69edd650c74a7f69e6c1281da80a /testsuite/tests/rename | |
parent | 5f2a8793514918eaa670347ce0d95dfdbbdd4f4d (diff) | |
download | haskell-28f41f1a7a0ebae7b50ca41dbf78c04ee5b8b5b7.tar.gz |
Fix #16002 by moving a validity check to the renamer
Summary:
The validity check which rejected things like:
```lang=haskell
type family B x where
A x = x
```
Used to live in the typechecker. But it turns out that this validity
check was //only// being run on closed type families without CUSKs!
This meant that GHC would silently accept something like this:
```lang=haskell
type family B (x :: *) :: * where
A x = x
```
This patch fixes the issue by moving this validity check to the
renamer, where we can be sure that the check will //always// be run.
Test Plan: make test TEST=T16002
Reviewers: simonpj, bgamari
Reviewed By: simonpj
Subscribers: goldfire, rwbarton, carter
GHC Trac Issues: #16002
Differential Revision: https://phabricator.haskell.org/D5420
Diffstat (limited to 'testsuite/tests/rename')
-rw-r--r-- | testsuite/tests/rename/should_fail/T16002.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/T16002.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/all.T | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/testsuite/tests/rename/should_fail/T16002.hs b/testsuite/tests/rename/should_fail/T16002.hs new file mode 100644 index 0000000000..00aadf14dd --- /dev/null +++ b/testsuite/tests/rename/should_fail/T16002.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE TypeFamilies #-} +module T16002 where + +data A +type family B (x :: *) :: * where + A x = x diff --git a/testsuite/tests/rename/should_fail/T16002.stderr b/testsuite/tests/rename/should_fail/T16002.stderr new file mode 100644 index 0000000000..98db6f99b6 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T16002.stderr @@ -0,0 +1,6 @@ + +T16002.hs:6:3: error: + Mismatched type name in type family instance. + Expected: B + Actual: A + In the declaration for type family ‘B’ diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T index ba6975483a..56934266d2 100644 --- a/testsuite/tests/rename/should_fail/all.T +++ b/testsuite/tests/rename/should_fail/all.T @@ -142,5 +142,6 @@ test('T15607', normal, compile_fail, ['']) test('T15611a', normal, compile_fail, ['']) test('T15611b', normal, ghci_script, ['T15611b.script']) test('T15828', normal, compile_fail, ['']) +test('T16002', normal, compile_fail, ['']) test('ExplicitForAllRules2', normal, compile_fail, ['']) |