diff options
Diffstat (limited to 'testsuite/tests/typecheck/should_compile/T15232.hs')
-rw-r--r-- | testsuite/tests/typecheck/should_compile/T15232.hs | 12 |
1 files changed, 12 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) |