[commit: ghc] master: Fix Trac #10519 (f856383)
git at git.haskell.org
git at git.haskell.org
Fri Jul 3 20:44:23 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/f8563838603f9a60f5012c3837142c5df89b8de2/ghc
>---------------------------------------------------------------
commit f8563838603f9a60f5012c3837142c5df89b8de2
Author: Thomas Winant <thomas.winant at cs.kuleuven.be>
Date: Fri Jul 3 19:35:29 2015 +0200
Fix Trac #10519
Look through nested foralls when checking the validity of a partial type
signature. The combination of D836 and D613 prompts this change.
Test Plan: The test T10519 must pass
Reviewers: simonpj, alanz, austin
Reviewed By: simonpj, alanz, austin
Subscribers: thomie, bgamari
Differential Revision: https://phabricator.haskell.org/D994
GHC Trac Issues: #10519
>---------------------------------------------------------------
f8563838603f9a60f5012c3837142c5df89b8de2
compiler/rename/RnTypes.hs | 2 +-
testsuite/tests/partial-sigs/should_compile/T10519.hs | 6 ++++++
testsuite/tests/partial-sigs/should_compile/T10519.stderr | 4 ++++
testsuite/tests/partial-sigs/should_compile/all.T | 1 +
4 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/compiler/rename/RnTypes.hs b/compiler/rename/RnTypes.hs
index 3766ed1..705ca55 100644
--- a/compiler/rename/RnTypes.hs
+++ b/compiler/rename/RnTypes.hs
@@ -554,7 +554,7 @@ rnLHsTypeWithWildCards doc ty
= do { -- When there is a wild card at the end of the context, remove it and
-- add its location as the extra-constraints wild card in the
-- HsForAllTy.
- let ty' = extractExtraCtsWc `fmap` ty
+ let ty' = extractExtraCtsWc `fmap` flattenTopLevelLHsForAllTy ty
; checkValidPartialType doc ty'
diff --git a/testsuite/tests/partial-sigs/should_compile/T10519.hs b/testsuite/tests/partial-sigs/should_compile/T10519.hs
new file mode 100644
index 0000000..66a59a7
--- /dev/null
+++ b/testsuite/tests/partial-sigs/should_compile/T10519.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE PartialTypeSignatures #-}
+module T10519 where
+
+foo :: forall a. _ => a -> a -> Bool
+foo x y = x == y
diff --git a/testsuite/tests/partial-sigs/should_compile/T10519.stderr b/testsuite/tests/partial-sigs/should_compile/T10519.stderr
new file mode 100644
index 0000000..254292f
--- /dev/null
+++ b/testsuite/tests/partial-sigs/should_compile/T10519.stderr
@@ -0,0 +1,4 @@
+
+T10519.hs:5:18: warning:
+ Found hole ‘_’ with inferred constraints: Eq a
+ In the type signature for ‘foo’: _ => a -> a -> Bool
diff --git a/testsuite/tests/partial-sigs/should_compile/all.T b/testsuite/tests/partial-sigs/should_compile/all.T
index 56f1045..e649472 100644
--- a/testsuite/tests/partial-sigs/should_compile/all.T
+++ b/testsuite/tests/partial-sigs/should_compile/all.T
@@ -48,3 +48,4 @@ test('UncurryNamed', normal, compile, ['-ddump-types -fno-warn-partial-type-sign
test('WarningWildcardInstantiations', normal, compile, ['-ddump-types'])
test('T10403', normal, compile, [''])
test('T10438', normal, compile, [''])
+test('T10519', normal, compile, [''])
More information about the ghc-commits
mailing list