summaryrefslogtreecommitdiff
path: root/testsuite/tests/partial-sigs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-04-12 15:09:37 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2017-04-13 09:23:53 +0100
commit0ae72512255ba66ef89bdfeea65a23ea6eb35124 (patch)
treea21ffcb040c1f53cfb8a1f548a8c284208dd623d /testsuite/tests/partial-sigs
parent037c2495d83bb7da7f15c8e076df2c575500d0fd (diff)
downloadhaskell-0ae72512255ba66ef89bdfeea65a23ea6eb35124.tar.gz
Yet more work on TcSimplify.simplifyInfer
The proximate cause for this patch is Trac #13482, which pointed out further subtle interactions between - Inferring the most general type of a function - A partial type signature for that function That led me into /further/ changes to the shiny new stuff in TcSimplify.simplifyInfer, decideQuantification, decideMonoTyVars, and related functions. Happily, I was able to make some of it quite a bit simpler, notably the bit about promoting free tyvars. I'm happy with the result. Moreover I fixed Trac #13524 at the same time. Happy days.
Diffstat (limited to 'testsuite/tests/partial-sigs')
-rw-r--r--testsuite/tests/partial-sigs/should_compile/NamedTyVar.stderr2
-rw-r--r--testsuite/tests/partial-sigs/should_compile/T13482.hs22
-rw-r--r--testsuite/tests/partial-sigs/should_compile/T13482.stderr31
-rw-r--r--testsuite/tests/partial-sigs/should_compile/all.T1
4 files changed, 55 insertions, 1 deletions
diff --git a/testsuite/tests/partial-sigs/should_compile/NamedTyVar.stderr b/testsuite/tests/partial-sigs/should_compile/NamedTyVar.stderr
index 53b6021309..d2442eb7ca 100644
--- a/testsuite/tests/partial-sigs/should_compile/NamedTyVar.stderr
+++ b/testsuite/tests/partial-sigs/should_compile/NamedTyVar.stderr
@@ -1,5 +1,5 @@
TYPE SIGNATURES
- foo :: forall a b. (a, b) -> (a, b)
+ foo :: forall b a. (a, b) -> (a, b)
TYPE CONSTRUCTORS
COERCION AXIOMS
Dependent modules: []
diff --git a/testsuite/tests/partial-sigs/should_compile/T13482.hs b/testsuite/tests/partial-sigs/should_compile/T13482.hs
new file mode 100644
index 0000000000..3af3a74231
--- /dev/null
+++ b/testsuite/tests/partial-sigs/should_compile/T13482.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE PartialTypeSignatures #-}
+{-# LANGUAGE AllowAmbiguousTypes #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE KindSignatures #-}
+
+module T12382 where
+
+minimal1_noksig :: forall m. ( _ ) => Int -> Bool
+minimal1_noksig _ = (mempty :: m) == (mempty :: m)
+
+minimal1 :: forall (m :: *). _ => Bool
+minimal1 = (mempty :: m) == (mempty :: m)
+
+minimal2 :: forall m. (Eq m, _) => Bool
+minimal2 = (mempty :: m) == (mempty :: m)
+
+minimal3 :: forall m. (Monoid m, _) => Bool
+minimal3 = (mempty :: m) == (mempty :: m)
+
+minimal4 :: forall m. (Monoid m, Eq m) => Bool
+minimal4 = (mempty :: m) == (mempty :: m)
+
diff --git a/testsuite/tests/partial-sigs/should_compile/T13482.stderr b/testsuite/tests/partial-sigs/should_compile/T13482.stderr
new file mode 100644
index 0000000000..87eef5caa7
--- /dev/null
+++ b/testsuite/tests/partial-sigs/should_compile/T13482.stderr
@@ -0,0 +1,31 @@
+
+T13482.hs:8:32: warning: [-Wpartial-type-signatures (in -Wdefault)]
+ • Found type wildcard ‘_’ standing for ‘(Monoid m, Eq m)’
+ Where: ‘m’ is a rigid type variable bound by
+ the inferred type of
+ minimal1_noksig :: (Monoid m, Eq m) => Int -> Bool
+ at T13482.hs:9:1-50
+ • In the type signature:
+ minimal1_noksig :: forall m. _ => Int -> Bool
+
+T13482.hs:11:30: warning: [-Wpartial-type-signatures (in -Wdefault)]
+ • Found type wildcard ‘_’ standing for ‘(Monoid m, Eq m)’
+ Where: ‘m’ is a rigid type variable bound by
+ the inferred type of minimal1 :: (Monoid m, Eq m) => Bool
+ at T13482.hs:12:1-41
+ • In the type signature: minimal1 :: forall (m :: *). _ => Bool
+
+T13482.hs:14:30: warning: [-Wpartial-type-signatures (in -Wdefault)]
+ • Found type wildcard ‘_’ standing for ‘Monoid m’
+ Where: ‘m’ is a rigid type variable bound by
+ the inferred type of minimal2 :: (Eq m, Monoid m) => Bool
+ at T13482.hs:15:1-41
+ • In the type signature: minimal2 :: forall m. (Eq m, _) => Bool
+
+T13482.hs:17:34: warning: [-Wpartial-type-signatures (in -Wdefault)]
+ • Found type wildcard ‘_’ standing for ‘Eq m’
+ Where: ‘m’ is a rigid type variable bound by
+ the inferred type of minimal3 :: (Monoid m, Eq m) => Bool
+ at T13482.hs:18:1-41
+ • In the type signature:
+ minimal3 :: forall m. (Monoid m, _) => Bool
diff --git a/testsuite/tests/partial-sigs/should_compile/all.T b/testsuite/tests/partial-sigs/should_compile/all.T
index e0400b05c2..bd0762ec2f 100644
--- a/testsuite/tests/partial-sigs/should_compile/all.T
+++ b/testsuite/tests/partial-sigs/should_compile/all.T
@@ -69,3 +69,4 @@ test('T12156', normal, compile_fail, ['-fdefer-typed-holes'])
test('T12531', normal, compile, ['-fdefer-typed-holes'])
test('T12845', normal, compile, [''])
test('T12844', normal, compile, [''])
+test('T13482', normal, compile, [''])