summaryrefslogtreecommitdiff
path: root/testsuite/tests/partial-sigs/should_fail
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-12-20 15:41:02 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2017-12-21 14:14:21 +0000
commit72938f5890dac81afad52bf58175c1e29ffbc6dd (patch)
tree97d7973a919901d4b4125524973eb0c328625534 /testsuite/tests/partial-sigs/should_fail
parent584cbd4a19887497776ce1f61c15df652b8b2ea4 (diff)
downloadhaskell-72938f5890dac81afad52bf58175c1e29ffbc6dd.tar.gz
Check for bogus quantified tyvars in partial type sigs
This fixes Trac #14479. Not difficult. See Note [Quantification and partial signatures] Wrinkle 4, in TcSimplify.
Diffstat (limited to 'testsuite/tests/partial-sigs/should_fail')
-rw-r--r--testsuite/tests/partial-sigs/should_fail/T14479.hs9
-rw-r--r--testsuite/tests/partial-sigs/should_fail/T14479.stderr10
-rw-r--r--testsuite/tests/partial-sigs/should_fail/all.T1
3 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/partial-sigs/should_fail/T14479.hs b/testsuite/tests/partial-sigs/should_fail/T14479.hs
new file mode 100644
index 0000000000..13ee256e83
--- /dev/null
+++ b/testsuite/tests/partial-sigs/should_fail/T14479.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE ScopedTypeVariables, PartialTypeSignatures #-}
+
+module T14479 where
+
+foo :: Num a => a -> a
+foo xxx = g xxx
+ where
+ g :: forall b. Num b => _ -> b
+ g y = xxx + y
diff --git a/testsuite/tests/partial-sigs/should_fail/T14479.stderr b/testsuite/tests/partial-sigs/should_fail/T14479.stderr
new file mode 100644
index 0000000000..84ba90a572
--- /dev/null
+++ b/testsuite/tests/partial-sigs/should_fail/T14479.stderr
@@ -0,0 +1,10 @@
+
+T14479.hs:9:5: error:
+ • Can't quantify over ‘b’
+ bound by the partial type signature: g :: forall b. Num b => _ -> b
+ • In an equation for ‘foo’:
+ foo xxx
+ = g xxx
+ where
+ g :: forall b. Num b => _ -> b
+ g y = xxx + y
diff --git a/testsuite/tests/partial-sigs/should_fail/all.T b/testsuite/tests/partial-sigs/should_fail/all.T
index bb813f0b08..91509c4f36 100644
--- a/testsuite/tests/partial-sigs/should_fail/all.T
+++ b/testsuite/tests/partial-sigs/should_fail/all.T
@@ -66,3 +66,4 @@ test('T12634', normal, compile_fail, [''])
test('T12732', normal, compile_fail, ['-fobject-code -fdefer-typed-holes'])
test('T14040a', normal, compile_fail, [''])
test('T14449', normal, compile_fail, [''])
+test('T14479', normal, compile_fail, [''])