Commit d2eb344a authored by Alec Theriault's avatar Alec Theriault Committed by Ben Gamari

Fix tests for `integer-simple`

A bunch of tests for `integer-simple` were now broken for a foolish reason:
unlike the `integer-gmp` case, there is no CorePrep optimization for turning
small integers directly into applications of `S#`.

Rather than port this optimization to `integer-simple` (which would involve
moving a bunch of `integer-simple` names into `PrelNames`), I switched
as many tests as possible to use `Int`.

The printing of `Integer` is already tested in `print037`.
parent f7def747
......@@ -467,9 +467,6 @@ def have_gdb( ):
def have_readelf( ):
return config.have_readelf
# Many tests sadly break with integer-simple due to GHCi's ignorance of it.
broken_without_gmp = unless(have_library('integer-gmp'), expect_broken(16043))
# ---
def high_memory_usage(name, opts):
......
......@@ -9,7 +9,7 @@ data SafeList x y where
safeHead :: SafeList x NonEmpty -> x
safeHead (Cons x _) = x
foo = Cons 3 (Cons 6 (Cons 9 Nil))
foo = Cons (3 :: Int) (Cons 6 (Cons 9 Nil))
data Dict x where
......@@ -17,4 +17,4 @@ data Dict x where
DictE :: Eq x => x -> Dict x
data Exist where
Exist :: forall a. a -> Exist
\ No newline at end of file
Exist :: forall a. a -> Exist
......@@ -5,7 +5,7 @@ qsort [] = []
qsort (a:as) = (qsort left) ++ [a] ++ (qsort right)
where (left,right) = (filter (<=a) as, filter (>a) as)
run = qsort [8, 4, 0, 3, 1, 23, 11, 18]
run = qsort [8 :: Int, 4, 0, 3, 1, 23, 11, 18]
-- > run
-- [0,1,3,4,8,11,18,23]
\ No newline at end of file
-- [0,1,3,4,8,11,18,23]
:seti -XMonomorphismRestriction
:l T2740.hs
:step f 1 2 3
:step f (1 :: Int) 2 3
:print x
:print y
:force x
......
Stopped in Test.f, T2740.hs:3:11-13
_result :: Bool = _
x :: Integer = 1
y :: Integer = 2
x :: Int = 1
y :: Int = 2
x = 1
y = 2
x = 1
......
......@@ -3,22 +3,22 @@ setTestOpts([extra_run_opts('-ignore-dot-ghci'),
normalise_slashes])
test('print001', broken_without_gmp, ghci_script, ['print001.script'])
test('print002', [broken_without_gmp, extra_files(['../Test.hs'])], ghci_script, ['print002.script'])
test('print003', [broken_without_gmp, extra_files(['../Test.hs'])], ghci_script, ['print003.script'])
test('print004', broken_without_gmp, ghci_script, ['print004.script'])
test('print005', [broken_without_gmp, extra_files(['../QSort.hs'])], ghci_script, ['print005.script'])
test('print006', [broken_without_gmp, extra_files(['../Test.hs'])], ghci_script, ['print006.script'])
test('print001', normal, ghci_script, ['print001.script'])
test('print002', extra_files(['../Test.hs']), ghci_script, ['print002.script'])
test('print003', extra_files(['../Test.hs']), ghci_script, ['print003.script'])
test('print004', normal, ghci_script, ['print004.script'])
test('print005', extra_files(['../QSort.hs']), ghci_script, ['print005.script'])
test('print006', extra_files(['../Test.hs']), ghci_script, ['print006.script'])
test('print007', extra_files(['../Test.hs']), ghci_script, ['print007.script'])
test('print008', [broken_without_gmp, extra_files(['../Test.hs'])], ghci_script, ['print008.script'])
test('print008', extra_files(['../Test.hs']), ghci_script, ['print008.script'])
test('print009', normal, ghci_script, ['print009.script'])
test('print010', [broken_without_gmp, extra_files(['../Test.hs'])], ghci_script, ['print010.script'])
test('print010', extra_files(['../Test.hs']), ghci_script, ['print010.script'])
test('print011', extra_files(['../Test.hs']), ghci_script, ['print011.script'])
test('print012', [broken_without_gmp, extra_files(['../GADT.hs', '../Test.hs'])], ghci_script, ['print012.script'])
test('print013', [broken_without_gmp, extra_files(['../GADT.hs'])], ghci_script, ['print013.script'])
test('print014', [broken_without_gmp, extra_files(['../GADT.hs'])], ghci_script, ['print014.script'])
test('print016', [broken_without_gmp, extra_files(['../Test.hs'])], ghci_script, ['print016.script'])
test('print017', [broken_without_gmp, extra_files(['../Test.hs'])], ghci_script, ['print017.script'])
test('print012', extra_files(['../GADT.hs', '../Test.hs']), ghci_script, ['print012.script'])
test('print013', extra_files(['../GADT.hs']), ghci_script, ['print013.script'])
test('print014', extra_files(['../GADT.hs']), ghci_script, ['print014.script'])
test('print016', extra_files(['../Test.hs']), ghci_script, ['print016.script'])
test('print017', extra_files(['../Test.hs']), ghci_script, ['print017.script'])
test('print018', extra_files(['../Test.hs']), ghci_script, ['print018.script'])
test('print019', extra_files(['../Test.hs']), ghci_script, ['print019.script'])
......@@ -31,12 +31,12 @@ test('print021', normal, ghci_script, ['print021.script'])
test('print022',
[when(arch('powerpc64'), expect_broken(14455))],
ghci_script, ['print022.script'])
test('print023', [broken_without_gmp, extra_files(['../Test.hs'])], ghci_script, ['print023.script'])
test('print024', [broken_without_gmp, extra_files(['../Test.hs'])], ghci_script, ['print024.script'])
test('print023', extra_files(['../Test.hs']), ghci_script, ['print023.script'])
test('print024', extra_files(['../Test.hs']), ghci_script, ['print024.script'])
test('print025', normal, ghci_script, ['print025.script'])
test('print026', normal, ghci_script, ['print026.script'])
test('print027', normal, ghci_script, ['print027.script'])
test('print028', broken_without_gmp, ghci_script, ['print028.script'])
test('print028', normal, ghci_script, ['print028.script'])
test('print029', normal, ghci_script, ['print029.script'])
test('print030', extra_files(['print029.hs']), ghci_script, ['print030.script'])
test('print031', normal, ghci_script, ['print031.script'])
......@@ -47,11 +47,11 @@ test('print035', extra_files(['../Unboxed.hs']), ghci_script, ['print035.script'
test('print036', expect_broken(9046), ghci_script, ['print036.script'])
test('print037', normal, ghci_script, ['print037.script'])
test('break001', [broken_without_gmp, extra_files(['../Test2.hs'])], ghci_script, ['break001.script'])
test('break001', extra_files(['../Test2.hs']), ghci_script, ['break001.script'])
test('break002', extra_files(['../Test2.hs']), ghci_script, ['break002.script'])
test('break003', extra_files(['../Test3.hs']), ghci_script, ['break003.script'])
test('break005', [broken_without_gmp, extra_files(['../QSort.hs'])], ghci_script, ['break005.script'])
test('break006', [broken_without_gmp, extra_files(['../Test3.hs'])], ghci_script, ['break006.script'])
test('break005', extra_files(['../QSort.hs']), ghci_script, ['break005.script'])
test('break006', extra_files(['../Test3.hs']), ghci_script, ['break006.script'])
test('break007', extra_files(['Break007.hs']), ghci_script, ['break007.script'])
test('break008', extra_files(['../Test3.hs']), ghci_script, ['break008.script'])
test('break009', [extra_files(['../Test6.hs']),
......@@ -74,12 +74,10 @@ test('break020', extra_files(['Break020b.hs']), ghci_script, ['break020.script']
test('break021', extra_files(['Break020b.hs', 'break020.hs']), ghci_script, ['break021.script'])
test('break024', combined_output, ghci_script, ['break024.script'])
test('break025', normal, ghci_script, ['break025.script'])
test('break026', broken_without_gmp, ghci_script, ['break026.script'])
test('break027', [broken_without_gmp, extra_files(['../QSort.hs'])], ghci_script, ['break027.script'])
test('break028', normal, ghci_script, ['break028.script'])
test('break026', normal, ghci_script, ['break026.script'])
test('break027', extra_files(['../QSort.hs']), ghci_script, ['break027.script'])
test('dynbrk001', extra_files(['../QSort.hs']), ghci_script, ['dynbrk001.script'])
test('dynbrk002', [broken_without_gmp, extra_files(['../QSort.hs'])], ghci_script, ['dynbrk002.script'])
test('dynbrk002', extra_files(['../QSort.hs']), ghci_script, ['dynbrk002.script'])
test('dynbrk003', normal, ghci_script, ['dynbrk003.script'])
test('dynbrk004', extra_files(['../mdo.hs']), ghci_script, ['dynbrk004.script'])
test('dynbrk005', [extra_files(['TupleN.hs']), expect_broken(1530)],
......@@ -94,12 +92,12 @@ test('listCommand001', [extra_files(['../Test3.hs']),
combined_output], ghci_script, ['listCommand001.script'])
test('listCommand002', normal, ghci_script, ['listCommand002.script'])
test('hist001', [broken_without_gmp, extra_files(['../Test3.hs']), extra_run_opts('+RTS -I0')],
test('hist001', [extra_files(['../Test3.hs']), extra_run_opts('+RTS -I0')],
ghci_script, ['hist001.script'])
test('hist002', [broken_without_gmp, extra_files(['../Test3.hs']), extra_run_opts('+RTS -I0')],
test('hist002', [extra_files(['../Test3.hs']), extra_run_opts('+RTS -I0')],
ghci_script, ['hist002.script'])
test('T2740', broken_without_gmp, ghci_script, ['T2740.script'])
test('T2740', normal, ghci_script, ['T2740.script'])
test('getargs', extra_files(['../getargs.hs']), ghci_script, ['getargs.script'])
test('T7386', normal, ghci_script, ['T7386.script'])
......
:l Test2
:b 3
:b 5
f (1 :: Integer)
f (1 :: Int)
:st
-- Test that the binding for x is now gone
:show bindings
......
Breakpoint 0 activated at Test2.hs:3:7-9
Breakpoint 1 activated at Test2.hs:5:7
Stopped in Test2.f, Test2.hs:3:7-9
_result :: Integer = _
x :: Integer = 1
_result :: Int = _
x :: Int = 1
Stopped in Test2.g, Test2.hs:5:7
_result :: Integer = _
y :: Integer = 1
y :: Integer = 1
_result :: Integer = _
_result :: Int = _
y :: Int = 1
y :: Int = 1
_result :: Int = _
1
y = 1
()
......
:l QSort
:st qsort [1::Integer,2]
:st qsort [1::Int,2]
:step
seq left ()
:print left
Stopped in QSort.qsort, QSort.hs:5:16-51
_result :: [Integer] = _
a :: Integer = 1
left :: [Integer] = _
right :: [Integer] = _
_result :: [Int] = _
a :: Int = 1
left :: [Int] = _
right :: [Int] = _
Stopped in QSort.qsort, QSort.hs:5:17-26
_result :: [a] = _
left :: [a] = _
......
:l Test3.hs
:st mymap (+1) [1::Integer,2,3]
:st mymap (+1) [1::Int,2,3]
:show bindings
f x -- should fail, unknown return type
let y = f x
......@@ -7,6 +7,6 @@ y
:p y
:force y
:show bindings
-- we know the result is Integer now
-- we know the result is Int now
f x
-- should work now
Stopped in Main.mymap, Test3.hs:2:18-31
_result :: [a] = _
f :: Integer -> a = _
x :: Integer = 1
xs :: [Integer] = [2,3]
xs :: [Integer] = [2,3]
f :: Integer -> a = _
x :: Integer = 1
f :: Int -> a = _
x :: Int = 1
xs :: [Int] = [2,3]
xs :: [Int] = [2,3]
f :: Int -> a = _
x :: Int = 1
_result :: [a] = _
y = (_t1::a)
y = 2
xs :: [Integer] = [2,3]
f :: Integer -> Integer = _
x :: Integer = 1
_result :: [Integer] = _
y :: Integer = 2
_t1 :: Integer = 2
xs :: [Int] = [2,3]
f :: Int -> Int = _
x :: Int = 1
_result :: [Int] = _
y :: Int = 2
_t1 :: Int = 2
2
:load break026
:step foldl (+) 0 [1::Integer .. 5]
:step foldl (+) 0 [1::Int .. 5]
:step
:step
:force c
-- answer should be 1
:load break026
:step foldl (+) 0 [1::Integer .. 5]
:step foldl (+) 0 [1::Int .. 5]
:step
:step
-- a diversion to single-step the evaluation of c:
......
Stopped in Test.foldl, break026.hs:5:16-22
_result :: Integer = _
c :: Integer = 0
go :: Integer -> [t1] -> Integer = _
_result :: Int = _
c :: Int = 0
go :: Int -> [t1] -> Int = _
xs :: [t1] = _
Stopped in Test.foldl.go, break026.hs:7:23-35
_result :: Integer = _
c :: Integer = 0
f :: Integer -> Integer -> Integer = _
x :: Integer = 1
xs :: [Integer] = _
_result :: Int = _
c :: Int = 0
f :: Int -> Int -> Int = _
x :: Int = 1
xs :: [Int] = _
Stopped in Test.foldl.go, break026.hs:7:23-35
_result :: t = _
c :: t = _
f :: t -> Integer -> t = _
x :: Integer = 2
xs :: [Integer] = _
f :: t -> Int -> t = _
x :: Int = 2
xs :: [Int] = _
c = 1
Stopped in Test.foldl, break026.hs:5:16-22
_result :: Integer = _
c :: Integer = 0
go :: Integer -> [t1] -> Integer = _
_result :: Int = _
c :: Int = 0
go :: Int -> [t1] -> Int = _
xs :: [t1] = _
Stopped in Test.foldl.go, break026.hs:7:23-35
_result :: Integer = _
c :: Integer = 0
f :: Integer -> Integer -> Integer = _
x :: Integer = 1
xs :: [Integer] = _
_result :: Int = _
c :: Int = 0
f :: Int -> Int -> Int = _
x :: Int = 1
xs :: [Int] = _
Stopped in Test.foldl.go, break026.hs:7:23-35
_result :: t = _
c :: t = _
f :: t -> Integer -> t = _
x :: Integer = 2
xs :: [Integer] = _
f :: t -> Int -> t = _
x :: Int = 2
xs :: [Int] = _
Stopped in Test.foldl.go, break026.hs:7:27-31
_result :: Integer = _
c :: Integer = 0
f :: Integer -> Integer -> Integer = _
x :: Integer = 1
_result :: Int = _
c :: Int = 0
f :: Int -> Int -> Int = _
x :: Int = 1
()
1
:l QSort
:break qsort
qsort [3::Integer,2,1]
qsort [3::Int,2,1]
:i a
Breakpoint 0 activated at QSort.hs:4:12-13
Breakpoint 1 activated at QSort.hs:5:16-51
Stopped in QSort.qsort, QSort.hs:5:16-51
_result :: [Integer] = _
a :: Integer = 3
left :: [Integer] = _
right :: [Integer] = _
a :: Integer -- Defined in ‘interactive:Ghci1’
_result :: [Int] = _
a :: Int = 3
left :: [Int] = _
right :: [Int] = _
a :: Int -- Defined in ‘interactive:Ghci1’
Breakpoint 0 activated at QSort.hs:5:16-51
Stopped in QSort.qsort, QSort.hs:5:16-51
_result :: [Integer] = _
a :: Integer = 8
left :: [Integer] = _
right :: [Integer] = _
_result :: [Int] = _
a :: Int = 8
left :: [Int] = _
right :: [Int] = _
......@@ -5,7 +5,15 @@ let f = Just (1.2::Float)
f
:p f
let i = Just (10::Integer)
-- With @integer-gmp@, small integer literals get converted directly into
-- @S# 10#@. This optimization means that small integers are always already
-- evaluated in the output for @:p@.
--
-- Since we want this test to work on @integer-simple@ too, we explicitly
-- force the literal.
let ten = 10 :: Integer
:f ten
let i = Just ten
:p i
case i of Just j -> Control.Exception.evaluate j
......@@ -16,4 +24,4 @@ case i of Just j -> Control.Exception.evaluate j
let s = S1 'a' 'b' 'c'
s
:p s
:sp s
\ No newline at end of file
:sp s
Just 1.2
f = Just 1.2
ten = 10
i = Just 10
10
i = Just 10
......
-- Simple Recovery of types - opaque types
:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
:l Test
let t = O (map Just [[1,1],[2,2]])
let t = O (map Just [[1 :: Int,1],[2,2]])
:p t
-- should have bound _t1 now
:show bindings
......
......@@ -9,7 +9,6 @@ it :: () = ()
_t3 :: [a0] = _
_t2 :: a0 = _
()
t = O (Just [1,1] : (_t4::[Maybe [Integer]]))
t = O (Just [1,1] : (_t4::[Maybe [Int]]))
()
t = O (Just [1,1] : (_t5::Maybe [Integer]) :
(_t6::[Maybe [Integer]]))
t = O (Just [1,1] : (_t5::Maybe [Int]) : (_t6::[Maybe [Int]]))
......@@ -2,7 +2,7 @@
:l QSort
:break 5
qsort [8::Integer, 4]
qsort [8::Int, 4]
:p right
seq right ()
......
Breakpoint 0 activated at QSort.hs:5:16-51
Stopped in QSort.qsort, QSort.hs:5:16-51
_result :: [Integer] = _
a :: Integer = 8
left :: [Integer] = _
right :: [Integer] = _
right = (_t1::[Integer])
_result :: [Int] = _
a :: Int = 8
left :: [Int] = _
right :: [Int] = _
right = (_t1::[Int])
()
right = []
left = (_t2::[Integer])
left = (_t2::[Int])
()
left = 4 : (_t3::[Integer])
left = 4 : (_t3::[Int])
1
left = [4]
Stopped in QSort.qsort, QSort.hs:5:16-51
_result :: [Integer] = _
a :: Integer = 4
left :: [Integer] = _
right :: [Integer] = _
_result :: [Int] = _
a :: Int = 4
left :: [Int] = _
right :: [Int] = _
......@@ -3,7 +3,7 @@
:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
:l Test
let t = O (map Just [[1,1],[2,2]])
let t = O (map Just [[1 :: Int,1],[2,2]])
:p t
seq _t1 () -- The contents of the opaque
:p t
......@@ -14,4 +14,4 @@ seq _t5 () -- The 2nd element of the list
seq _t7 () -- The 1st element of the outer list
:p t
-- The 1st Just must be completely typed, as we know the type of the list
\ No newline at end of file
-- The 1st Just must be completely typed, as we know the type of the list
......@@ -4,7 +4,6 @@ t = O ((_t2::a0) : (_t3::[a0]))
()
t = O ((_t4::a1) : (_t5::a1) : (_t6::[a1]))
()
t = O ((_t7::Maybe [Integer]) : Just [2,2] :
(_t8::[Maybe [Integer]]))
t = O ((_t7::Maybe [Int]) : Just [2,2] : (_t8::[Maybe [Int]]))
()
t = O (Just [1,1] : Just [2,2] : (_t9::[Maybe [Integer]]))
t = O (Just [1,1] : Just [2,2] : (_t9::[Maybe [Int]]))
......@@ -3,7 +3,7 @@
:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
:l Test
let t = O (map Just [[1,1],[2,2]])
let t = O (map Just [[1 :: Int,1],[2,2]])
:p t
:t _t1
......@@ -11,4 +11,4 @@ seq _t1 ()
:p t
seq _t2 ()
:p t
:t _t4
\ No newline at end of file
:t _t4
......@@ -3,5 +3,5 @@ _t1 :: a0
()
t = O ((_t2::a0) : (_t3::[a0]))
()
t = O (Just [1,1] : (_t4::[Maybe [Integer]]))
_t4 :: [Maybe [Integer]]
t = O (Just [1,1] : (_t4::[Maybe [Int]]))
_t4 :: [Maybe [Int]]
o = O (_t1::a0)
()
_t1 :: SafeList Integer NonEmpty
o = O (Cons 3 (_t4::SafeList Integer y0))
_t1 :: SafeList Int NonEmpty
o = O (Cons 3 (_t4::SafeList Int y0))
()
o = O (Cons 3 (Cons 6 (_t9::SafeList Integer y0)))
o = O (Cons 3 (Cons 6 (_t9::SafeList Int y0)))
......@@ -3,7 +3,7 @@
:set -XGADTs -XRankNTypes
:l GADT
let d = DictN (1 :: Integer)
let d = DictN (1 :: Int)
:p d
seq _t1 ()
:p d
......
......@@ -3,5 +3,5 @@
:set -XGADTs -XRankNTypes
:l GADT
let e = Exist 1
let e = Exist (1 :: Int)
:p e
let test = 0 :: Integer
let test = 0 :: Int
:show bindings
:force test
:show bindings
......
test :: Integer = 0
test :: Int = 0
test = 0
test :: Integer = 0
test :: Int = 0
test :: [Char] = _
test = "test"
test :: [Char] = "test"
......@@ -91,7 +91,7 @@ test('ghci051', normal, ghci_script, ['ghci051.script'])
test('ghci052', normal, ghci_script, ['ghci052.script'])
test('ghci053', normal, ghci_script, ['ghci053.script'])
test('ghci054', normal, ghci_script, ['ghci054.script'])
test('ghci055', [broken_without_gmp, combined_output], ghci_script, ['ghci055.script'])
test('ghci055', combined_output, ghci_script, ['ghci055.script'])
test('ghci056',
[pre_cmd('$MAKE -s --no-print-directory ghci056_setup'),
......@@ -116,7 +116,7 @@ test('T1914', [], ghci_script, ['T1914.script'])
test('T2182ghci', normal, ghci_script, ['T2182ghci.script'])
test('T2182ghci2', [extra_hc_opts("-XNoImplicitPrelude")], ghci_script, ['T2182ghci2.script'])
test('T2976', broken_without_gmp, ghci_script, ['T2976.script'])
test('T2976', normal, ghci_script, ['T2976.script'])
test('T2816', normal, ghci_script, ['T2816.script'])
test('T789', normal, ghci_script, ['T789.script'])
test('T3263', normal, ghci_script, ['T3263.script'])
......
let x=undefined
let y=3 :: Integer
let y=3 :: Int
:force x
:show bindings
-- in 7.3 and earlier this used to print just "*** Exception:
......
......@@ -3,4 +3,4 @@ CallStack (from HasCallStack):
error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
undefined, called at <interactive>:1:5 in interactive:Ghci1
x :: a = _
y :: Integer = 3
y :: Int = 3
......@@ -3,7 +3,7 @@ test('integerConversions', normal, compile_and_run, [''])
# skip ghci as it doesn't support unboxed tuples
test('integerGmpInternals', [reqlib('integer-gmp'), omit_ways('ghci')], compile_and_run, [''])
test('plusMinusInteger', [omit_ways('ghci')], compile_and_run, [''])
test('integerConstantFolding', broken_without_gmp, run_command,
test('integerConstantFolding', normal, run_command,
['$MAKE -s --no-print-directory integerConstantFolding'])
test('fromToInteger', [], run_command,
['$MAKE -s --no-print-directory fromToInteger'])
......
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