summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/T20588.hs
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2021-11-09 23:23:35 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-11-10 18:19:37 -0500
commit1540f556a4501056056eec7d45d3c9246e8213d9 (patch)
tree10b836f740100da5d47932e4c7b6df766a35ba64 /testsuite/tests/typecheck/should_fail/T20588.hs
parentdfb9913c530d9132700fd5252c763e43976ece45 (diff)
downloadhaskell-1540f556a4501056056eec7d45d3c9246e8213d9.tar.gz
Clarify hs-boot file default method restrictions
The user guide wrongly stated that default methods should not be included in hs-boot files. In fact, if the class is not left abstract (no methods, no superclass constraints, ...) then the defaults must be provided and match with those given in the .hs file. We add some tests for this, as there were no tests in the testsuite that gave rise to the "missing default methods" error. Fixes #20588
Diffstat (limited to 'testsuite/tests/typecheck/should_fail/T20588.hs')
-rw-r--r--testsuite/tests/typecheck/should_fail/T20588.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T20588.hs b/testsuite/tests/typecheck/should_fail/T20588.hs
new file mode 100644
index 0000000000..475c68ef2d
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T20588.hs
@@ -0,0 +1,15 @@
+
+{-# LANGUAGE TypeFamilies #-}
+
+module T20588 where
+
+import Data.Kind
+
+class C (a :: Type) where
+ {-# MINIMAL meth #-}
+ meth :: a -> a
+ meth = id
+
+class D (a :: Type) where
+ type family T a :: Type
+ type instance T a = Int