diff options
author | Matthew Yacavone <matthew@yacavone.net> | 2018-11-29 18:42:39 -0500 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-11-29 18:44:13 -0500 |
commit | fe57a5bae3f8cb87637359f615c77f4afae86d46 (patch) | |
tree | d36f6a009aa8c027e8b02b032301ec1c535b787e /testsuite/tests/rename/should_fail | |
parent | 2257a86daa72db382eb927df12a718669d5491f8 (diff) | |
download | haskell-fe57a5bae3f8cb87637359f615c77f4afae86d46.tar.gz |
Fix #15828, from `More explicit foralls`
Summary:
Fix a bug in commit 12eeb9 which permits the following:
```
class C a where
type T a b
instance C (Maybe a) where
type forall a b. T (Maybe a) b = b
```
where instead, the user should write:
```
instance C (Maybe a) where
type forall b. T (Maybe a) b = b
```
Update the users guide to discuss scoping of type variables in
explicit foralls in type family instances.
Test Plan: validate
Reviewers: bgamari, goldfire, monoidal
Reviewed By: goldfire
Subscribers: monoidal, rwbarton, carter
GHC Trac Issues: #15828
Differential Revision: https://phabricator.haskell.org/D5283
Diffstat (limited to 'testsuite/tests/rename/should_fail')
-rw-r--r-- | testsuite/tests/rename/should_fail/T15828.hs | 9 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/T15828.stderr | 9 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/all.T | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/rename/should_fail/T15828.hs b/testsuite/tests/rename/should_fail/T15828.hs new file mode 100644 index 0000000000..90c06214c4 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T15828.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE TypeFamilies, ExplicitForAll #-} + +module T15828 where + +class C a where + type T a b + +instance C (Maybe a) where + type forall a b. T (Maybe a) b = b diff --git a/testsuite/tests/rename/should_fail/T15828.stderr b/testsuite/tests/rename/should_fail/T15828.stderr new file mode 100644 index 0000000000..aca2542d88 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T15828.stderr @@ -0,0 +1,9 @@ + +T15828.hs:9:20: error: + • Type indexes must match class instance head + Expected: T (Maybe a1) <tv> + Actual: T (Maybe a) b + where the `<tv>' arguments are type variables, + distinct from each other and from the instance variables + • In the type instance declaration for ‘T’ + In the instance declaration for ‘C (Maybe a)’
\ No newline at end of file diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T index 9ca330f873..6fd014356c 100644 --- a/testsuite/tests/rename/should_fail/all.T +++ b/testsuite/tests/rename/should_fail/all.T @@ -140,5 +140,6 @@ test('T15659', normal, compile_fail, ['']) test('T15607', normal, compile_fail, ['']) test('T15611a', normal, compile_fail, ['']) test('T15611b', normal, ghci_script, ['T15611b.script']) +test('T15828', normal, compile_fail, ['']) test('ExplicitForAllRules2', normal, compile_fail, ['']) |