Commit 5c466ca9 authored by dterei's avatar dterei

More fixes to Safe Haskell test for design changes

parent ac8c6325
- No test for infer safe when overlapping used
- Should just the enabling of RULES make a module unsafe or only if there are actual rules defined?
- As above but with newtype deriving
{-# LANGUAGE Unsafe #-}
module Check03 where
import Check03_B
......
......@@ -37,7 +37,7 @@ test('SafeFlags14', normal, compile_fail, [''])
test('SafeFlags15', normal, compile, [''])
test('SafeFlags16', normal, compile, [''])
test('SafeFlags17', normal, compile_fail, ['-distrust base'])
test('SafeFlags18', normal, compile, [''])
test('SafeFlags18', normal, compile, ['-trust base'])
test('SafeFlags19', normal, compile_fail, [''])
test('SafeFlags20', normal, compile, ['-trust base'])
......
{-# LANGUAGE Unsafe #-}
-- | Should fail compilation because we import Data.Word as safe and unsafe
module Mixed03 where
import safe qualified Data.Word as DW
import System.IO
import Data.Word
f :: Int
f = 1
Mixed03.hs:5:1:
Module DW is imported both as a safe and unsafe import!
[1 of 2] Compiling SafeInfered01_A ( SafeInfered01_A.hs, SafeInfered01_A.o )
[2 of 2] Compiling SafeInfered01 ( SafeInfered01.hs, SafeInfered01.o )
[1 of 2] Compiling SafeInfered02_A ( SafeInfered02_A.hs, SafeInfered02_A.o )
[2 of 2] Compiling SafeInfered02 ( SafeInfered02.hs, SafeInfered02.o )
[1 of 2] Compiling SafeInfered03_A ( SafeInfered03_A.hs, SafeInfered03_A.o )
[2 of 2] Compiling SafeInfered03 ( SafeInfered03.hs, SafeInfered03.o )
......@@ -26,4 +26,5 @@ test('UnsafeInfered09', normal, multimod_compile_fail, ['UnsafeInfered09', ''])
# Mixed tests
test('Mixed01', normal, compile_fail, [''])
test('Mixed02', normal, compile_fail, [''])
test('Mixed03', normal, compile_fail, [''])
BadImport01.hs:4:1:
BadImport01.hs:5:1:
base:System.IO.Unsafe can't be safely imported! The module itself isn't safe.
BadImport04.hs:5:1:
base:Foreign can't be safely imported! The module itself isn't safe.
BadImport05.hs:5:1:
base:System.IO.Unsafe can't be safely imported! The module itself isn't safe.
BadImport06.hs:5:1:
base:Debug.Trace can't be safely imported! The module itself isn't safe.
BadImport07.hs:5:1:
base:Unsafe.Coerce can't be safely imported! The module itself isn't safe.
BadImport08.hs:5:1:
base:Control.Monad.ST can't be safely imported! The module itself isn't safe.
{-# LANGUAGE Safe #-}
-- | Import unsafe module Foreign.Marshal to make sure it fails
module Main where
import Foreign.Marshal
f :: Int
f = unsafeLocalState $ putStrLn "What kind of swallow?" >> return 2
main :: IO ()
main = putStrLn $ "X is: " ++ show f
BadImport09.hs:5:1:
base:Foreign.Marshal can't be safely imported! The module itself isn't safe.
Dep05.hs:5:1:
base:GHC.Arr can't be safely imported! The module itself isn't safe.
Dep06.hs:4:1:
base:GHC.Conc can't be safely imported! The module itself isn't safe.
Dep07.hs:4:1:
base:GHC.ForeignPtr can't be safely imported! The module itself isn't safe.
Dep08.hs:5:1:
base:GHC.IOArray can't be safely imported! The module itself isn't safe.
Dep09.hs:4:1:
base:GHC.Ptr can't be safely imported! The module itself isn't safe.
Dep10.hs:4:1:
base:GHC.ST can't be safely imported! The module itself isn't safe.
......@@ -75,7 +75,7 @@ import Foreign.C.Error
import Foreign.C.String
import Foreign.C.Types
import Foreign.Marshal
-- import Foreign.Marshal
import Foreign.Marshal.Alloc
import Foreign.Marshal.Array
import Foreign.Marshal.Error
......
......@@ -36,6 +36,7 @@ test('BadImport05', normal, compile_fail, [''])
test('BadImport06', normal, compile_fail, [''])
test('BadImport07', normal, compile_fail, [''])
test('BadImport08', normal, compile_fail, [''])
test('BadImport09', normal, compile_fail, [''])
# check safe modules are marked safe
test('GoodImport01', normal, compile, [''])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment