diff options
author | Krzysztof Gogolewski <krz.gogolewski@gmail.com> | 2014-09-18 14:52:50 -0700 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2014-09-18 14:53:46 -0700 |
commit | 275dcafbfb6b371dd5d8943fa4df9c23e68f6165 (patch) | |
tree | 11edf1e79c8879fd836549531d3be0f2825a5108 /testsuite/tests/rename | |
parent | ed58ec059c3a3d6f550f42b2707e59f851b8f90d (diff) | |
download | haskell-275dcafbfb6b371dd5d8943fa4df9c23e68f6165.tar.gz |
Add -fwarn-context-quantification (#4426)
Summary:
This warning (enabled by default) reports places where a context
implicitly binds a type variable, for example
type T a = {-forall m.-} Monad m => a -> m a
Also update Haddock submodule.
Test Plan: validate
Reviewers: hvr, goldfire, simonpj, austin
Reviewed By: austin
Subscribers: simonmar, ezyang, carter
Differential Revision: https://phabricator.haskell.org/D211
GHC Trac Issues: #4426
Diffstat (limited to 'testsuite/tests/rename')
-rw-r--r-- | testsuite/tests/rename/should_compile/T4426.hs | 22 | ||||
-rw-r--r-- | testsuite/tests/rename/should_compile/T4426.stderr | 35 | ||||
-rw-r--r-- | testsuite/tests/rename/should_compile/all.T | 1 |
3 files changed, 58 insertions, 0 deletions
diff --git a/testsuite/tests/rename/should_compile/T4426.hs b/testsuite/tests/rename/should_compile/T4426.hs new file mode 100644 index 0000000000..b04f59cd03 --- /dev/null +++ b/testsuite/tests/rename/should_compile/T4426.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE RankNTypes #-} +{-# OPTIONS_GHC -fwarn-context-quantification #-} + +module T4426 where + +type F a = Monad m => a -> m a + +data X a = X (Eq b => a -> b) + +data Y a = Y { k :: Eq b => a -> b -> c } + +f :: forall b. (Monad m => m b) -> b +f = undefined + +type F' a = forall m. Monad m => a -> m a + +data X' a = X' (forall b. Eq b => a -> b) + +data Y' a = Y' { k' :: forall b c. Eq b => a -> b -> c } + +f' :: forall b. (forall m. Monad m => m b) -> b +f' = undefined diff --git a/testsuite/tests/rename/should_compile/T4426.stderr b/testsuite/tests/rename/should_compile/T4426.stderr new file mode 100644 index 0000000000..f4e0c471d6 --- /dev/null +++ b/testsuite/tests/rename/should_compile/T4426.stderr @@ -0,0 +1,35 @@ + +T4426.hs:6:12: Warning: + Variable ‘m’ is implicitly quantified due to a context + Use explicit forall syntax instead. + This will become an error in GHC 7.12. + In the type ‘Monad m => a -> m a’ + In the declaration for type synonym ‘F’ + +T4426.hs:8:15: Warning: + Variable ‘b’ is implicitly quantified due to a context + Use explicit forall syntax instead. + This will become an error in GHC 7.12. + In the type ‘Eq b => a -> b’ + In the definition of data constructor ‘X’ + +T4426.hs:10:21: Warning: + Variable ‘b’ is implicitly quantified due to a context + Use explicit forall syntax instead. + This will become an error in GHC 7.12. + In the type ‘Eq b => a -> b -> c’ + In the definition of data constructor ‘Y’ + +T4426.hs:10:21: Warning: + Variable ‘c’ is implicitly quantified due to a context + Use explicit forall syntax instead. + This will become an error in GHC 7.12. + In the type ‘Eq b => a -> b -> c’ + In the definition of data constructor ‘Y’ + +T4426.hs:12:17: Warning: + Variable ‘m’ is implicitly quantified due to a context + Use explicit forall syntax instead. + This will become an error in GHC 7.12. + In the type ‘Monad m => m b’ + In the type signature for ‘f’ diff --git a/testsuite/tests/rename/should_compile/all.T b/testsuite/tests/rename/should_compile/all.T index d104df4910..7185fba5b8 100644 --- a/testsuite/tests/rename/should_compile/all.T +++ b/testsuite/tests/rename/should_compile/all.T @@ -217,3 +217,4 @@ test('T7969', run_command, ['$MAKE -s --no-print-directory T7969']) test('T9127', normal, compile, ['']) +test('T4426', normal, compile, ['']) |