diff options
author | David Terei <code@davidterei.com> | 2014-08-04 17:43:09 -0400 |
---|---|---|
committer | David Terei <code@davidterei.com> | 2014-11-06 11:16:38 -0800 |
commit | f4ead30b96aa8faaf4d23815cc32f7adfadd28df (patch) | |
tree | 05a49146183f09d917b2d9b5560741003977e1f4 /testsuite/tests/safeHaskell/safeInfered | |
parent | c96a613c98d07fab4facc77bdd0701b7a17d332a (diff) | |
download | haskell-f4ead30b96aa8faaf4d23815cc32f7adfadd28df.tar.gz |
Warn for Safe Haskell when -XOverlappingInstances or
-XIncoherentInstances turned on.
Diffstat (limited to 'testsuite/tests/safeHaskell/safeInfered')
9 files changed, 50 insertions, 4 deletions
diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered16.hs b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered16.hs index 2df65765aa..b3e7f34586 100644 --- a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered16.hs +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered16.hs @@ -1,6 +1,6 @@ {-# OPTIONS_GHC -fwarn-unsafe -Werror #-} {-# LANGUAGE FlexibleInstances #-} -module UnsafeInfered15 where +module UnsafeInfered16 where class C a where f :: a -> String diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered16.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered16.stderr index 21674c407b..5ac27d3d82 100644 --- a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered16.stderr +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered16.stderr @@ -1,6 +1,6 @@ UnsafeInfered16.hs:1:16: Warning: - ‘UnsafeInfered15’ has been inferred as unsafe! + ‘UnsafeInfered16’ has been inferred as unsafe! Reason: UnsafeInfered16.hs:8:30: [overlapping] overlap mode isn't allowed in Safe Haskell diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.hs b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.hs index 04591b5f77..7f17a136ff 100644 --- a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.hs +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.hs @@ -1,6 +1,6 @@ {-# OPTIONS_GHC -fwarn-unsafe -Werror #-} {-# LANGUAGE FlexibleInstances #-} -module UnsafeInfered15 where +module UnsafeInfered17 where class C a where f :: a -> String diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.stderr index 415e9a1f37..aa43fbeeed 100644 --- a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.stderr +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered17.stderr @@ -1,6 +1,6 @@ UnsafeInfered17.hs:1:16: Warning: - ‘UnsafeInfered15’ has been inferred as unsafe! + ‘UnsafeInfered17’ has been inferred as unsafe! Reason: UnsafeInfered17.hs:8:29: [incoherent] overlap mode isn't allowed in Safe Haskell diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered18.hs b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered18.hs new file mode 100644 index 0000000000..a6dbfe1745 --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered18.hs @@ -0,0 +1,11 @@ +{-# OPTIONS_GHC -fwarn-unsafe #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE OverlappingInstances #-} +module UnsafeInfered18 where + +class C a where + f :: a -> String + +instance C a where + f _ = "a" + diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered18.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered18.stderr new file mode 100644 index 0000000000..0896ec500f --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered18.stderr @@ -0,0 +1,11 @@ + +UnsafeInfered18.hs:3:14: Warning: + -XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS + +UnsafeInfered18.hs:1:16: Warning: + ‘UnsafeInfered18’ has been inferred as unsafe! + Reason: + UnsafeInfered18.hs:3:14: + -XOverlappingInstances is not allowed in Safe Haskell + UnsafeInfered18.hs:9:10: + [overlap ok] overlap mode isn't allowed in Safe Haskell diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered19.hs b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered19.hs new file mode 100644 index 0000000000..587bc4edbf --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered19.hs @@ -0,0 +1,11 @@ +{-# OPTIONS_GHC -fwarn-unsafe -Werror #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE IncoherentInstances #-} +module UnsafeInfered19 where + +class C a where + f :: a -> String + +instance C a where + f _ = "a" + diff --git a/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered19.stderr b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered19.stderr new file mode 100644 index 0000000000..002c950930 --- /dev/null +++ b/testsuite/tests/safeHaskell/safeInfered/UnsafeInfered19.stderr @@ -0,0 +1,11 @@ + +UnsafeInfered19.hs:1:16: Warning: + ‘UnsafeInfered19’ has been inferred as unsafe! + Reason: + UnsafeInfered19.hs:3:14: + -XIncoherentInstances is not allowed in Safe Haskell + UnsafeInfered19.hs:9:10: + [incoherent] overlap mode isn't allowed in Safe Haskell + +<no location info>: +Failing due to -Werror. diff --git a/testsuite/tests/safeHaskell/safeInfered/all.T b/testsuite/tests/safeHaskell/safeInfered/all.T index 4fc9fcecb8..c2222a3549 100644 --- a/testsuite/tests/safeHaskell/safeInfered/all.T +++ b/testsuite/tests/safeHaskell/safeInfered/all.T @@ -65,6 +65,8 @@ test('UnsafeInfered14', normal, compile_fail, ['']) test('UnsafeInfered15', normal, compile_fail, ['']) test('UnsafeInfered16', normal, compile_fail, ['']) test('UnsafeInfered17', normal, compile_fail, ['']) +test('UnsafeInfered18', normal, compile, ['']) +test('UnsafeInfered19', normal, compile_fail, ['']) # Mixed tests test('Mixed01', normal, compile_fail, ['']) |