[commit: ghc] master: testsuite: Add test for #15232 (5026840)

git at git.haskell.org git at git.haskell.org
Fri Jun 8 00:08:00 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/5026840fddc86c3bc10693eed676fbf6a74f4227/ghc

>---------------------------------------------------------------

commit 5026840fddc86c3bc10693eed676fbf6a74f4227
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Thu Jun 7 13:27:37 2018 -0400

    testsuite: Add test for #15232
    
    Subscribers: rwbarton, thomie, carter
    
    GHC Trac Issues: #15232
    
    Differential Revision: https://phabricator.haskell.org/D4807


>---------------------------------------------------------------

5026840fddc86c3bc10693eed676fbf6a74f4227
 testsuite/tests/typecheck/should_compile/T15232.hs | 12 ++++++++++++
 testsuite/tests/typecheck/should_compile/all.T     |  1 +
 2 files changed, 13 insertions(+)

diff --git a/testsuite/tests/typecheck/should_compile/T15232.hs b/testsuite/tests/typecheck/should_compile/T15232.hs
new file mode 100644
index 0000000..ec7659a
--- /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 4328234..2b7b9ef 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, [''])
 



More information about the ghc-commits mailing list