summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/typecheck/should_compile/T15232.hs12
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T1
2 files changed, 13 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T15232.hs b/testsuite/tests/typecheck/should_compile/T15232.hs
new file mode 100644
index 0000000000..ec7659ac38
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T15232.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# OPTIONS_GHC -Wredundant-constraints -Wall -Werror #-}
+import GHC.TypeLits (TypeError, ErrorMessage(..))
+
+class C a where f :: a -> a
+instance {-# OVERLAPPING #-} C Int where f _ = 42
+instance {-# OVERLAPPABLE #-} TypeError ( 'Text "Only Int is supported" ) => C a where f = undefined
+
+main :: IO ()
+main = print $ f (42::Int)
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index 43282341cc..2b7b9ef1bd 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -621,4 +621,5 @@ test('SplitWD', normal, compile, [''])
test('T14441', omit_ways(['profasm']), compile, [''])
test('T15050', [expect_broken(15050)], compile, [''])
test('T14735', normal, compile, [''])
+test('T15232', expect_broken(15232), compile, [''])