diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-05-09 16:36:39 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-05-23 13:38:32 -0400 |
commit | 82cb8913b38d44ef20e928ff8b08f3f0770ebf80 (patch) | |
tree | c7bf0ba7c066831221bfab7eb2b2269d55f50f5c /testsuite/tests/rename | |
parent | dcd6bdcce57430d08b335014625722c487ea08e4 (diff) | |
download | haskell-82cb8913b38d44ef20e928ff8b08f3f0770ebf80.tar.gz |
Fix #18145 and also avoid needless work with implicit vars
- `forAllOrNothing` now is monadic, so we can trace whether we bind
an explicit `forall` or not.
- #18145 arose because the free vars calculation was needlessly
complex. It is now greatly simplified.
- Replaced some other implicit var code with `filterFreeVarsToBind`.
Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
Diffstat (limited to 'testsuite/tests/rename')
-rw-r--r-- | testsuite/tests/rename/should_fail/T18145.hs | 17 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/T18145.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/all.T | 1 |
3 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/tests/rename/should_fail/T18145.hs b/testsuite/tests/rename/should_fail/T18145.hs new file mode 100644 index 0000000000..f991f3b19c --- /dev/null +++ b/testsuite/tests/rename/should_fail/T18145.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE ExplicitForAll #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE DataKinds #-} + +module T18145 where + +type family A :: k +type instance forall. A = Nothing :: Maybe a -- 'a' should be out of scope + +class Foo x where + type B x :: Maybe a + type forall x. B x = Nothing :: Maybe a -- 'a' should be out of scope + +instance Foo [x] where + type forall. B [x] = Nothing :: Maybe a -- 'a' should be out of scope diff --git a/testsuite/tests/rename/should_fail/T18145.stderr b/testsuite/tests/rename/should_fail/T18145.stderr new file mode 100644 index 0000000000..606ad0f695 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T18145.stderr @@ -0,0 +1,6 @@ + +T18145.hs:10:44: error: Not in scope: type variable ‘a’ + +T18145.hs:14:41: error: Not in scope: type variable ‘a’ + +T18145.hs:17:41: error: Not in scope: type variable ‘a’ diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T index 179ff13560..27b359dec1 100644 --- a/testsuite/tests/rename/should_fail/all.T +++ b/testsuite/tests/rename/should_fail/all.T @@ -153,3 +153,4 @@ test('T16504', normal, compile_fail, ['']) test('T14548', normal, compile_fail, ['']) test('T16610', normal, compile_fail, ['']) test('T17593', normal, compile_fail, ['']) +test('T18145', normal, compile_fail, ['']) |