summaryrefslogtreecommitdiff
path: root/testsuite/tests/safeHaskell/safeLanguage
diff options
context:
space:
mode:
authorAustin Seipp <austin@well-typed.com>2014-02-16 19:14:36 -0600
committerAustin Seipp <austin@well-typed.com>2014-02-17 01:46:04 -0600
commita8a01e742434df11b830ab99af12d9045dfcbc4b (patch)
tree959310ee2b5963b1540b93cc3b2416694c7f4688 /testsuite/tests/safeHaskell/safeLanguage
parent5023c91780e90947680fe0640f7564a4f6448bea (diff)
downloadhaskell-a8a01e742434df11b830ab99af12d9045dfcbc4b.tar.gz
Fix #8745 - GND is now -XSafe compatible.
As discussed in the ticket, after the landing of #8773, GND is now -XSafe compatible. This fixes the test fallout as well. In particular SafeLang07 was removed following in the steps of SafeLang06, since it no longer failed from GND, but failed due to roles and was thus invalid. The other tests were tweaked to use TemplateHaskell instead of GND in order to trigger safety warnings. Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'testsuite/tests/safeHaskell/safeLanguage')
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang02.hs2
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang02.stderr2
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang07.hs41
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang07.stderr7
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang07_A.hs24
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/all.T7
6 files changed, 5 insertions, 78 deletions
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang02.hs b/testsuite/tests/safeHaskell/safeLanguage/SafeLang02.hs
index 9bf1c82a09..8bc3f3cd00 100644
--- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang02.hs
+++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang02.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE Safe, GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE Safe, TemplateHaskell #-}
-- | Test SafeLanguage disables things
module SafeLang02 where
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang02.stderr b/testsuite/tests/safeHaskell/safeLanguage/SafeLang02.stderr
index 069e5be4e9..e1643ed32b 100644
--- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang02.stderr
+++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang02.stderr
@@ -1,3 +1,3 @@
SafeLang02.hs:1:20:
- Warning: -XGeneralizedNewtypeDeriving is not allowed in Safe Haskell; ignoring -XGeneralizedNewtypeDeriving
+ Warning: -XTemplateHaskell is not allowed in Safe Haskell; ignoring -XTemplateHaskell
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang07.hs b/testsuite/tests/safeHaskell/safeLanguage/SafeLang07.hs
deleted file mode 100644
index 006cd0ea08..0000000000
--- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang07.hs
+++ /dev/null
@@ -1,41 +0,0 @@
-{-# LANGUAGE Safe #-}
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-
--- Here we stop it succeeding (SAFE)
-
--- | We use newtype to create an isomorphic type to Int
--- with a reversed Ord dictionary. We now use the MinList
--- API of Y1 to create a new MinList. Then we use newtype
--- deriving to convert the newtype MinList to an Int
--- MinList. This final result breaks the invariants of
--- MinList which shouldn't be possible with the exposed
--- API of Y1.
-module Main where
-
-import SafeLang07_A
-
-class IntIso t where
- intIso :: c t -> c Int
-
-instance IntIso Int where
- intIso = id
-
-newtype Down a = Down a deriving (Eq, Show, IntIso)
-
-instance Ord a => Ord (Down a) where
- compare (Down a) (Down b) = compare b a
-
-forceInt :: MinList Int -> MinList Int
-forceInt = id
-
-a1, a2 :: MinList Int
-a1 = foldl insertMinList (newMinList $ head nums) (tail nums)
-a2 = forceInt $ intIso $ foldl (\x y -> insertMinList x $ Down y) (newMinList $ Down $ head nums) (tail nums)
-
-nums :: [Int]
-nums = [1,4,0,1,-5,2,3,5,-1,2,0,0,-4,-3,9]
-
-main = do
- printIntMinList a1
- printIntMinList a2
-
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang07.stderr b/testsuite/tests/safeHaskell/safeLanguage/SafeLang07.stderr
deleted file mode 100644
index 50c0ef7e56..0000000000
--- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang07.stderr
+++ /dev/null
@@ -1,7 +0,0 @@
-
-SafeLang07.hs:2:14: Warning:
- -XGeneralizedNewtypeDeriving is not allowed in Safe Haskell; ignoring -XGeneralizedNewtypeDeriving
-
-SafeLang07.hs:15:1:
- Failed to load interface for ‛SafeLang07_A’
- Use -v to see a list of the files searched for.
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang07_A.hs b/testsuite/tests/safeHaskell/safeLanguage/SafeLang07_A.hs
deleted file mode 100644
index 6ef49d5946..0000000000
--- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang07_A.hs
+++ /dev/null
@@ -1,24 +0,0 @@
-{-# LANGUAGE Trustworthy #-}
-
--- | Here we expose a MinList API that only allows elements
--- to be inserted into a list if they are at least greater
--- than an initial element the list is created with.
-module SafeLang07_A (
- MinList,
- newMinList,
- insertMinList,
- printIntMinList
- ) where
-
-data MinList a = MinList a [a]
-
-newMinList :: Ord a => a -> MinList a
-newMinList n = MinList n []
-
-insertMinList :: Ord a => MinList a -> a -> MinList a
-insertMinList s@(MinList m xs) n | n > m = MinList m (n:xs)
- | otherwise = s
-
-printIntMinList :: MinList Int -> IO ()
-printIntMinList (MinList min xs) = putStrLn $ "MinList Int :: MinList " ++ show min ++ " " ++ show xs
-
diff --git a/testsuite/tests/safeHaskell/safeLanguage/all.T b/testsuite/tests/safeHaskell/safeLanguage/all.T
index 5932348594..dc968917fb 100644
--- a/testsuite/tests/safeHaskell/safeLanguage/all.T
+++ b/testsuite/tests/safeHaskell/safeLanguage/all.T
@@ -15,11 +15,10 @@ test('SafeLang03', normal, compile, [''])
test('SafeLang04', normal, compile_and_run, [''])
test('SafeLang05', normal, compile_and_run, [''])
-# SafeLang06 was a test involving GeneralizedNewtypeDeriving, but the code
-# fails to compile with roles; thus the test is no longer valid and has
-# been removed
+# SafeLang06 and SafeLang07 wwere tests involving
+# GeneralizedNewtypeDeriving, but the code failed to compile with
+# roles; thus the tests were no longer valid and have been removed
-test('SafeLang07', normal, compile_fail, [''])
test('SafeLang08', normal, compile_fail, [''])
test('SafeLang09',
[exit_code(1),