Commit f3cb7ecb authored by dimitris's avatar dimitris
Browse files

Merge branch 'master' of http://darcs.haskell.org/testsuite

Conflicts:
	tests/typecheck/should_compile/all.T
parents 2ed41c1c 751f0306
......@@ -1056,6 +1056,8 @@ tests/typecheck/should_run/T3731
tests/typecheck/should_run/T3731-short
tests/typecheck/should_run/T4809
tests/typecheck/should_run/T5759
tests/typecheck/should_run/T5573a
tests/typecheck/should_run/T5573b
tests/typecheck/should_run/church
tests/typecheck/should_run/mc17
tests/typecheck/should_run/tcrun001
......@@ -1102,6 +1104,11 @@ tests/typecheck/should_run/tcrun043
tests/typecheck/should_run/tcrun044
tests/typecheck/should_run/tcrun045
tests/typecheck/should_run/tcrun046
tests/typecheck/should_run/tcrun047
tests/typecheck/should_run/tcrun048
tests/typecheck/should_run/tcrun049
tests/typecheck/should_run/tcrun050
tests/typecheck/should_run/tcrun051
tests/typecheck/should_run/testeq2
tests/typecheck/testeq1/typecheck.testeq1
......
-- Test #6146 (a bug in -feager-blackholing) I couldn't reliably
-- reproduce it, but this program occasionally triggers it so it's
-- better than nothing.
module Main (main) where
import System.IO
import Control.Concurrent
import System.Mem
main :: IO ()
main = do
putStrLn "First number? "
num1 <- readLn :: IO Int
performGC -- provokes bug (sometimes)
putStrLn "Second number? "
num2 <- readLn :: IO Int
let total = num1 + num2
putStrLn $ "The sum is " ++ (show total) ++ "."
First number?
Second number?
The sum is 5.
......@@ -91,3 +91,5 @@ test('5747', if_arch('i386', extra_hc_opts('-msse2')), compile_and_run, ['-O2'])
test('5785', normal, compile_and_run, [''])
test('setByteArray', normal, compile_and_run, [''])
test('6146', normal, compile_and_run, [''])
drvfail002.hs:16:10:
Ambiguous constraint `X T c'
At least one of the forall'd type variables mentioned by the constraint
must be reachable from the type after the '=>'
In the instance declaration for `Show T'
drvfail002.hs:19:23:
No instance for (X T c)
arising from the 'deriving' clause of a data type declaration
Possible fix:
add an instance declaration for (X T c)
or use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
When deriving the instance for (Show S)
TOP=../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
clean:
rm -f *.o *.hi
T6145: clean
'$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 -package ghc T6145
./T6145 "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`"
.PHONY: clean T6145
{-# LANGUAGE PatternGuards #-}
module Main where
import System.IO
import GHC
import MonadUtils
import Outputable
import Bag (filterBag,isEmptyBag)
import System.Directory (removeFile)
import System.Environment( getArgs )
main::IO()
main = do
let c="module Test where\ndata DataT=MkData {name :: String}\n"
writeFile "Test.hs" c
[libdir] <- getArgs
ok<- runGhc (Just libdir) $ do
dflags <- getSessionDynFlags
setSessionDynFlags dflags
let mn =mkModuleName "Test"
addTarget Target { targetId = TargetModule mn, targetAllowObjCode = True, targetContents = Nothing }
load LoadAllTargets
modSum <- getModSummary mn
p <- parseModule modSum
t <- typecheckModule p
d <- desugarModule t
l <- loadModule d
let ts=typecheckedSource l
-- liftIO (putStr (showSDocDebug (ppr ts)))
let fs=filterBag getDataCon ts
return $ not $ isEmptyBag fs
removeFile "Test.hs"
print ok
where
getDataCon (L _ (AbsBinds { abs_binds = bs }))
= not (isEmptyBag (filterBag getDataCon bs))
getDataCon (L l (f@FunBind {}))
| (MatchGroup (m:_) _)<-fun_matches f,
(L _ (c@ConPatOut{}):_)<-hsLMatchPats m,
(L l _)<-pat_con c
= isGoodSrcSpan l -- Check that the source location is a good one
getDataCon _
= False
test('T6145', [skip_if_fast],
run_command,
['$MAKE -s --no-print-directory T6145'])
data Unboxed1 = Unboxed1 (# Int, Bool #)
data Unboxed2 = Unboxed2 (# Int, (# Int, Bool #) #)
o1 = Unboxed1 (# 5, True #)
o2 = Unboxed2 (# 6, (# 7, False #) #)
force_them :: Int
force_them = x + (if b then 1 else 2) + y + z + (if c then 3 else 4)
where
Unboxed1 (# x, b #) = o1
Unboxed2 (# y, (# z, c #) #) = o2
\ No newline at end of file
......@@ -35,6 +35,7 @@ test('print031', normal, ghci_script, ['print031.script'])
test('print032', normal, ghci_script, ['print032.script'])
test('print033', normal, ghci_script, ['print033.script'])
test('print034', normal, ghci_script, ['print034.script'])
test('print035', normal, ghci_script, ['print035.script'])
test('break001', normal, ghci_script, ['break001.script'])
test('break002', normal, ghci_script, ['break002.script'])
......
Stopped at break026.hs:(5,1)-(7,35)
_result :: t1 = _
_result :: t = _
Stopped at break026.hs:5:16-22
_result :: Integer = _
c :: Integer = 0
go :: Integer -> [t] -> Integer = _
xs :: [t] = _
go :: Integer -> [t1] -> Integer = _
xs :: [t1] = _
Stopped at break026.hs:(6,9)-(7,35)
_result :: t1 = _
f :: t1 -> t -> t1 = _
_result :: t = _
f :: t -> t1 -> t = _
Stopped at break026.hs:7:23-35
_result :: Integer = _
c :: Integer = 0
......@@ -15,25 +15,25 @@ f :: Integer -> Integer -> Integer = _
x :: Integer = 1
xs :: [Integer] = _
Stopped at break026.hs:(6,9)-(7,35)
_result :: t1 = _
f :: t1 -> t -> t1 = _
_result :: t = _
f :: t -> t1 -> t = _
Stopped at break026.hs:7:23-35
_result :: t1 = _
c :: t1 = _
f :: t1 -> Integer -> t1 = _
_result :: t = _
c :: t = _
f :: t -> Integer -> t = _
x :: Integer = 2
xs :: [Integer] = _
c = 1
Stopped at break026.hs:(5,1)-(7,35)
_result :: t1 = _
_result :: t = _
Stopped at break026.hs:5:16-22
_result :: Integer = _
c :: Integer = 0
go :: Integer -> [t] -> Integer = _
xs :: [t] = _
go :: Integer -> [t1] -> Integer = _
xs :: [t1] = _
Stopped at break026.hs:(6,9)-(7,35)
_result :: t1 = _
f :: t1 -> t -> t1 = _
_result :: t = _
f :: t -> t1 -> t = _
Stopped at break026.hs:7:23-35
_result :: Integer = _
c :: Integer = 0
......@@ -41,12 +41,12 @@ f :: Integer -> Integer -> Integer = _
x :: Integer = 1
xs :: [Integer] = _
Stopped at break026.hs:(6,9)-(7,35)
_result :: t1 = _
f :: t1 -> t -> t1 = _
_result :: t = _
f :: t -> t1 -> t = _
Stopped at break026.hs:7:23-35
_result :: t1 = _
c :: t1 = _
f :: t1 -> Integer -> t1 = _
_result :: t = _
c :: t = _
f :: t -> Integer -> t = _
x :: Integer = 2
xs :: [Integer] = _
Stopped at break026.hs:7:27-31
......
-- Unboxed tuples in data constructor arguments need to be
-- handled correctly by RtClosureInspect
:set -XUnboxedTuples -fobject-code
:l ../Unboxed
:p o1
:p o2
force_them
:p o1
:p o2
\ No newline at end of file
o1 = (_t1::Unboxed1)
o2 = (_t2::Unboxed2)
23
o1 = Unboxed1 ((#,#) 5 True)
o2 = Unboxed2 ((#,#) 6 ((#,#) 7 False))
......@@ -18,3 +18,10 @@ T5955:
$(RM) T5955.o T5955.hi T5955a.o T5955a.hi
'$(TEST_HC)' $(TEST_HC_OPTS) -c T5955a.hs
'$(TEST_HC)' $(TEST_HC_OPTS) -c T5955.hs
# Compiling twice made 7.4.1 break
T6152:
$(RM) T6152.o T6152.hi
'$(TEST_HC)' $(TEST_HC_OPTS) -c T6152.hs
'$(TEST_HC)' $(TEST_HC_OPTS) -c T6152.hs -fforce-recomp
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE EmptyDataDecls #-}
module T6088 where
class C a
newtype A n = A Int
type family Pos n
data True
instance (Pos n ~ True) => C (A n)
newtype B n = B (A n) deriving (C)
-- This should work, giving
-- instance (Pos n ~ True) => C (B n)
{-# LANGUAGE DataKinds, TypeFamilies, GADTs #-}
module T6152 where
data U = Unit
data SU (a :: U) where
SInt :: SU Unit
type family I (a :: U) :: U
type instance I Unit = Unit
type SUI a = SU (I a)
......@@ -188,3 +188,10 @@ test('T5955',
extra_clean(['T5955.o', 'T5955.hi', 'T5955a.o', 'T5955a.hi']),
run_command,
['$MAKE -s --no-print-directory T5955'])
test('T6152',
normal,
run_command,
['$MAKE -s --no-print-directory T6152'])
test('T6088', normal, compile, [''])
......@@ -2,6 +2,7 @@
module Main (main) where
import Data.Bits
import Data.Word
main :: IO ()
main = do p "plusInteger" plusInteger
......@@ -50,6 +51,10 @@ main = do p "plusInteger" plusInteger
p "floatFromInteger" floatFromInteger
p "encodeIntegerDouble" encodeIntegerDouble
p "encodeIntegerFloat" encodeIntegerFloat
p "integerToWord" integerToWord
p "integerToInt" integerToInt
p "wordToInteger" wordToInteger
p "intToInteger" intToInteger
where p :: Show a => String -> a -> IO ()
p str x = putStrLn (str ++ ": " ++ show x)
......@@ -179,3 +184,15 @@ encodeIntegerDouble = encodeFloat 100069 2
encodeIntegerFloat :: Float
encodeIntegerFloat = encodeFloat 100070 2
integerToWord :: Word
integerToWord = fromInteger 100071 + 100072
integerToInt :: Int
integerToInt = fromInteger 100073 + 100074
wordToInteger :: Integer
wordToInteger = toInteger (100075 :: Word) + 100076
intToInteger :: Integer
intToInteger = toInteger (100077 :: Int) + 100078
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