summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2017-03-01 00:11:43 -0800
committerEdward Z. Yang <ezyang@cs.stanford.edu>2017-03-02 15:59:02 -0800
commitbba004f2a0642d3bb8c8876543aaa1a48a2f9a43 (patch)
treedbf421874c9e5ae537652851006c2b38144acd72 /testsuite/tests
parentdf919fb21c951c1892bd96d9e6306ce1bec3daa9 (diff)
downloadhaskell-bba004f2a0642d3bb8c8876543aaa1a48a2f9a43.tar.gz
Prevent users from defining instances for abstract classes.
Summary: Fixes #13068. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3254
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/typecheck/should_fail/T13068.hs4
-rw-r--r--testsuite/tests/typecheck/should_fail/T13068.hs-boot2
-rw-r--r--testsuite/tests/typecheck/should_fail/T13068.stderr6
-rw-r--r--testsuite/tests/typecheck/should_fail/T13068a.hs3
-rw-r--r--testsuite/tests/typecheck/should_fail/T13068m.hs2
-rw-r--r--testsuite/tests/typecheck/should_fail/all.T1
6 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T13068.hs b/testsuite/tests/typecheck/should_fail/T13068.hs
new file mode 100644
index 0000000000..e0b8f57c94
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T13068.hs
@@ -0,0 +1,4 @@
+module T13068 where
+import T13068a
+class C a where
+ f :: a
diff --git a/testsuite/tests/typecheck/should_fail/T13068.hs-boot b/testsuite/tests/typecheck/should_fail/T13068.hs-boot
new file mode 100644
index 0000000000..b23b752349
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T13068.hs-boot
@@ -0,0 +1,2 @@
+module T13068 where
+class C a
diff --git a/testsuite/tests/typecheck/should_fail/T13068.stderr b/testsuite/tests/typecheck/should_fail/T13068.stderr
new file mode 100644
index 0000000000..c161209001
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T13068.stderr
@@ -0,0 +1,6 @@
+[1 of 4] Compiling T13068[boot] ( T13068.hs-boot, T13068.o-boot )
+[2 of 4] Compiling T13068a ( T13068a.hs, T13068a.o )
+
+T13068a.hs:3:1: error:
+ • Cannot define instance for abstract class ‘C’
+ • In the instance declaration for ‘C Int’
diff --git a/testsuite/tests/typecheck/should_fail/T13068a.hs b/testsuite/tests/typecheck/should_fail/T13068a.hs
new file mode 100644
index 0000000000..fb7bda627a
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T13068a.hs
@@ -0,0 +1,3 @@
+module T13068a where
+import {-# SOURCE #-} T13068
+instance C Int where
diff --git a/testsuite/tests/typecheck/should_fail/T13068m.hs b/testsuite/tests/typecheck/should_fail/T13068m.hs
new file mode 100644
index 0000000000..3effc0a159
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T13068m.hs
@@ -0,0 +1,2 @@
+import T13068
+main = print (f :: Int)
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index 86334bac76..2d1d12bf74 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -424,6 +424,7 @@ test('T12918b', normal, compile_fail, [''])
test('T12921', normal, compile_fail, [''])
test('T12973', normal, compile_fail, [''])
test('StrictBinds', normal, compile_fail, [''])
+test('T13068', [extra_files(['T13068.hs', 'T13068a.hs', 'T13068.hs-boot', 'T13068m.hs'])], multimod_compile_fail, ['T13068m', ''])
test('T13105', normal, compile_fail, [''])
test('LevPolyBounded', normal, compile_fail, [''])
test('T13292', normal, multimod_compile, ['T13292', '-v0 -fdefer-type-errors'])