diff options
Diffstat (limited to 'testsuite')
36 files changed, 226 insertions, 210 deletions
diff --git a/testsuite/.gitignore b/testsuite/.gitignore index b4cd2d536e..e166811566 100644 --- a/testsuite/.gitignore +++ b/testsuite/.gitignore @@ -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 diff --git a/testsuite/tests/ghci.debugger/Unboxed.hs b/testsuite/tests/ghci.debugger/Unboxed.hs new file mode 100644 index 0000000000..a285fefb8f --- /dev/null +++ b/testsuite/tests/ghci.debugger/Unboxed.hs @@ -0,0 +1,12 @@ +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 diff --git a/testsuite/tests/ghci.debugger/scripts/all.T b/testsuite/tests/ghci.debugger/scripts/all.T index d7a1403b18..6dfd05baee 100644 --- a/testsuite/tests/ghci.debugger/scripts/all.T +++ b/testsuite/tests/ghci.debugger/scripts/all.T @@ -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']) diff --git a/testsuite/tests/ghci.debugger/scripts/break026.stdout b/testsuite/tests/ghci.debugger/scripts/break026.stdout index 444738aad4..9afc3f470e 100644 --- a/testsuite/tests/ghci.debugger/scripts/break026.stdout +++ b/testsuite/tests/ghci.debugger/scripts/break026.stdout @@ -1,13 +1,13 @@ 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 diff --git a/testsuite/tests/ghci.debugger/scripts/print035.script b/testsuite/tests/ghci.debugger/scripts/print035.script new file mode 100644 index 0000000000..fece23b46f --- /dev/null +++ b/testsuite/tests/ghci.debugger/scripts/print035.script @@ -0,0 +1,10 @@ +-- 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 diff --git a/testsuite/tests/ghci.debugger/scripts/print035.stdout b/testsuite/tests/ghci.debugger/scripts/print035.stdout new file mode 100644 index 0000000000..8f89277ee2 --- /dev/null +++ b/testsuite/tests/ghci.debugger/scripts/print035.stdout @@ -0,0 +1,5 @@ +o1 = (_t1::Unboxed1) +o2 = (_t2::Unboxed2) +23 +o1 = Unboxed1 ((#,#) 5 True) +o2 = Unboxed2 ((#,#) 6 ((#,#) 7 False)) diff --git a/testsuite/tests/typecheck/should_compile/tc141.stderr b/testsuite/tests/typecheck/should_compile/tc141.stderr index db8448f464..a22689b10f 100644 --- a/testsuite/tests/typecheck/should_compile/tc141.stderr +++ b/testsuite/tests/typecheck/should_compile/tc141.stderr @@ -1,43 +1,43 @@ -
-tc141.hs:11:12:
- You cannot bind scoped type variable `a'
- in a pattern binding signature
- In the pattern: p :: a
- In the pattern: (p :: a, q :: a)
- In a pattern binding: (p :: a, q :: a) = x
-
-tc141.hs:11:31:
- Couldn't match expected type `a1' with actual type `a'
- `a1' is a rigid type variable bound by
- an expression type signature: a1 at tc141.hs:11:31
- `a' is a rigid type variable bound by
- the inferred type of f :: (a, a) -> (t, a) at tc141.hs:11:1
- In the expression: q :: a
- In the expression: (q :: a, p)
- In the expression: let (p :: a, q :: a) = x in (q :: a, p)
-
-tc141.hs:13:13:
- You cannot bind scoped type variable `a'
- in a pattern binding signature
- In the pattern: y :: a
- In a pattern binding: y :: a = a
- In the expression:
- let y :: a = a in
- let
- v :: a
- v = b
- in v
-
-tc141.hs:15:18:
- Couldn't match expected type `a2' with actual type `t'
- `a2' is a rigid type variable bound by
- the type signature for v :: a2 at tc141.hs:14:19
- `t' is a rigid type variable bound by
- the inferred type of g :: a -> t -> a1 at tc141.hs:13:1
- In the expression: b
- In an equation for `v': v = b
- In the expression:
- let
- v :: a
- v = b
- in v
+ +tc141.hs:11:12: + You cannot bind scoped type variable `a' + in a pattern binding signature + In the pattern: p :: a + In the pattern: (p :: a, q :: a) + In a pattern binding: (p :: a, q :: a) = x + +tc141.hs:11:31: + Couldn't match expected type `a1' with actual type `a' + `a1' is a rigid type variable bound by + an expression type signature: a1 at tc141.hs:11:31 + `a' is a rigid type variable bound by + the inferred type of f :: (a, a) -> (t, a) at tc141.hs:11:1 + In the expression: q :: a + In the expression: (q :: a, p) + In the expression: let (p :: a, q :: a) = x in (q :: a, p) + +tc141.hs:13:13: + You cannot bind scoped type variable `a' + in a pattern binding signature + In the pattern: y :: a + In a pattern binding: y :: a = a + In the expression: + let y :: a = a in + let + v :: a + v = b + in v + +tc141.hs:15:18: + Couldn't match expected type `a2' with actual type `t' + `a2' is a rigid type variable bound by + the type signature for v :: a2 at tc141.hs:14:19 + `t' is a rigid type variable bound by + the inferred type of g :: a -> t -> a1 at tc141.hs:13:1 + In the expression: b + In an equation for `v': v = b + In the expression: + let + v :: a + v = b + in v diff --git a/testsuite/tests/typecheck/should_fail/T5573a.hs b/testsuite/tests/typecheck/should_fail/T5573a.hs deleted file mode 100644 index 13b384848d..0000000000 --- a/testsuite/tests/typecheck/should_fail/T5573a.hs +++ /dev/null @@ -1,16 +0,0 @@ -{-# LANGUAGE MagicHash, UnboxedTuples, BangPatterns #-} -module T5573a where - -import GHC.Exts - --- This is ok -foo1 x = (# x,x #) -bar y = let (# x, _ #) = foo1 y in x - --- Nested unboxed tuple not ok -foo2 x = (# x, (# True, False #) #) - --- Unboxed tuple argument not ok -foo3 (# x,y #) = x - - diff --git a/testsuite/tests/typecheck/should_fail/T5573a.stderr b/testsuite/tests/typecheck/should_fail/T5573a.stderr deleted file mode 100644 index 52aa99ae71..0000000000 --- a/testsuite/tests/typecheck/should_fail/T5573a.stderr +++ /dev/null @@ -1,16 +0,0 @@ - -T5573a.hs:11:16: - Couldn't match kind `ArgKind' against `(#)' - Kind incompatibility when matching types: - t0 :: ArgKind - (# t0, t1 #) :: (#) - In the expression: (# True, False #) - In the expression: (# x, (# True, False #) #) - -T5573a.hs:14:6: - Couldn't match kind `ArgKind' against `(#)' - Kind incompatibility when matching types: - t0 :: ArgKind - (# t0, t1 #) :: (#) - In the pattern: (# x, y #) - In an equation for `foo3': foo3 (# x, y #) = x diff --git a/testsuite/tests/typecheck/should_fail/T5573b.hs b/testsuite/tests/typecheck/should_fail/T5573b.hs deleted file mode 100644 index 0a187c9b87..0000000000 --- a/testsuite/tests/typecheck/should_fail/T5573b.hs +++ /dev/null @@ -1,8 +0,0 @@ -{-# LANGUAGE MagicHash, UnboxedTuples, BangPatterns #-} -module T5573b where - -import GHC.Exts - -foo :: Double# -> (# (# Double#, Double# #), Double# #) -foo x = (# (# x, x #), x #) - diff --git a/testsuite/tests/typecheck/should_fail/T5573b.stderr b/testsuite/tests/typecheck/should_fail/T5573b.stderr deleted file mode 100644 index b2cbf6d0eb..0000000000 --- a/testsuite/tests/typecheck/should_fail/T5573b.stderr +++ /dev/null @@ -1,7 +0,0 @@ - -T5573b.hs:6:22: - Kind mis-match - The first argument of an unboxed tuple should have kind `ArgKind', - but `(# Double#, Double# #)' has kind `(#)' - In the type signature for `foo': - foo :: Double# -> (# (# Double#, Double# #), Double# #) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index e27d0ccaa0..98df6dad39 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -73,7 +73,6 @@ test('tcfail083', normal, compile_fail, ['']) test('tcfail084', normal, compile_fail, ['']) test('tcfail085', normal, compile_fail, ['']) test('tcfail086', normal, compile_fail, ['']) -test('tcfail087', only_compiler_types(['ghc']), compile_fail, ['']) test('tcfail088', normal, compile_fail, ['']) test('tcfail089', normal, compile_fail, ['']) test('tcfail090', only_compiler_types(['ghc']), compile_fail, ['']) @@ -99,12 +98,10 @@ test('tcfail110', normal, compile_fail, ['']) test('tcfail112', normal, compile_fail, ['']) test('tcfail113', normal, compile_fail, ['']) test('tcfail114', normal, compile_fail, ['']) -test('tcfail115', only_compiler_types(['ghc']), compile_fail, ['']) test('tcfail116', normal, compile_fail, ['']) test('tcfail117', normal, compile_fail, ['']) test('tcfail118', normal, compile_fail, ['']) test('tcfail119', normal, compile_fail, ['']) -test('tcfail120', only_compiler_types(['ghc']), compile_fail, ['']) test('tcfail121', normal, compile_fail, ['']) test('tcfail122', only_compiler_types(['ghc']), compile_fail, ['']) test('tcfail123', only_compiler_types(['ghc']), compile_fail, ['']) @@ -128,7 +125,6 @@ test('tcfail138', normal, compile, ['']) test('tcfail139', normal, compile_fail, ['']) test('tcfail140', normal, compile_fail, ['']) -test('tcfail141', only_compiler_types(['ghc']), compile_fail, ['']) test('tcfail142', normal, compile_fail, ['']) test('tcfail143', normal, compile_fail, ['']) test('tcfail144', normal, compile, ['']) @@ -266,8 +262,6 @@ test('AssocTyDef08', normal, compile_fail, ['']) test('AssocTyDef09', normal, compile_fail, ['']) test('T3592', normal, compile_fail, ['']) test('T5570', normal, compile_fail, ['']) -test('T5573a', normal, compile_fail, ['']) -test('T5573b', normal, compile_fail, ['']) test('T5691', normal, compile_fail, ['']) test('T5689', normal, compile_fail, ['']) test('T5684', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_fail/tcfail087.hs b/testsuite/tests/typecheck/should_fail/tcfail087.hs deleted file mode 100644 index 6055a13d21..0000000000 --- a/testsuite/tests/typecheck/should_fail/tcfail087.hs +++ /dev/null @@ -1,13 +0,0 @@ -{-# LANGUAGE UnboxedTuples #-} - --- !!! Check that unboxed tuples can't be function arguments -module ShouldFail where - -data Ex = Ex (# Int,Int #) - -f :: (# Int,Int #) -> Int -f x = error "urk" - -g (# x,y #) = x - - diff --git a/testsuite/tests/typecheck/should_fail/tcfail087.stderr b/testsuite/tests/typecheck/should_fail/tcfail087.stderr deleted file mode 100644 index 3c244ddc8b..0000000000 --- a/testsuite/tests/typecheck/should_fail/tcfail087.stderr +++ /dev/null @@ -1,7 +0,0 @@ -
-tcfail087.hs:6:14:
- Kind mis-match
- Expected kind `ArgKind', but `(# Int, Int #)' has kind `(#)'
- In the type `(# Int, Int #)'
- In the definition of data constructor `Ex'
- In the data declaration for `Ex'
diff --git a/testsuite/tests/typecheck/should_fail/tcfail115.hs b/testsuite/tests/typecheck/should_fail/tcfail115.hs deleted file mode 100644 index 971f625a9a..0000000000 --- a/testsuite/tests/typecheck/should_fail/tcfail115.hs +++ /dev/null @@ -1,13 +0,0 @@ -{-# LANGUAGE UnboxedTuples #-} - --- Unboxed tuples; c.f. tcfail120, tc209 - -module ShouldFail where - -type T a = Int -> (# Int, Int #) - -g t = case t of r -> (r :: (# Int, Int #)) - -f :: T a -> T a -f t = \x -> case t x of r -> r - diff --git a/testsuite/tests/typecheck/should_fail/tcfail115.stderr b/testsuite/tests/typecheck/should_fail/tcfail115.stderr deleted file mode 100644 index 89f5178c87..0000000000 --- a/testsuite/tests/typecheck/should_fail/tcfail115.stderr +++ /dev/null @@ -1,14 +0,0 @@ - -tcfail115.hs:9:24: - Couldn't match kind `ArgKind' against `(#)' - Kind incompatibility when matching types: - t0 :: ArgKind - (# Int, Int #) :: (#) - In the expression: (r :: (# Int, Int #)) - In a case alternative: r -> (r :: (# Int, Int #)) - -tcfail115.hs:12:25: - The variable `r' cannot have an unboxed tuple type: (# Int, Int #) - In a case alternative: r -> r - In the expression: case t x of { r -> r } - In the expression: \ x -> case t x of { r -> r } diff --git a/testsuite/tests/typecheck/should_fail/tcfail120.hs b/testsuite/tests/typecheck/should_fail/tcfail120.hs deleted file mode 100644 index 04b7cd60ab..0000000000 --- a/testsuite/tests/typecheck/should_fail/tcfail120.hs +++ /dev/null @@ -1,14 +0,0 @@ - -{-# LANGUAGE UnboxedTuples #-} - --- Could be ok, because nothing is bound to the unboxed tuple --- but actually rejected, because a wild card is rather like --- an unused variable. Could fix this, but it's really a corner case - -module ShouldFail where - -type T a = Int -> (# Int, Int #) - -f2 :: T a -> T a -f2 t = \x -> case t x of _ -> (# 3,4 #) - diff --git a/testsuite/tests/typecheck/should_fail/tcfail120.stderr b/testsuite/tests/typecheck/should_fail/tcfail120.stderr deleted file mode 100644 index 7693b0c7c5..0000000000 --- a/testsuite/tests/typecheck/should_fail/tcfail120.stderr +++ /dev/null @@ -1,7 +0,0 @@ - -tcfail120.hs:13:26: - A wild-card pattern cannot have an unboxed tuple type: - (# Int, Int #) - In the pattern: _ - In a case alternative: _ -> (# 3, 4 #) - In the expression: case t x of { _ -> (# 3, 4 #) } diff --git a/testsuite/tests/typecheck/should_fail/tcfail141.hs b/testsuite/tests/typecheck/should_fail/tcfail141.hs deleted file mode 100644 index 12504d04f3..0000000000 --- a/testsuite/tests/typecheck/should_fail/tcfail141.hs +++ /dev/null @@ -1,17 +0,0 @@ -{-# LANGUAGE MagicHash, UnboxedTuples #-} - --- Should fail, because f :: (# Int#, ByteArray# #) - -module ShouldFail where - -import GHC.Prim (Int#, ByteArray#) - -main :: IO () -main = let f = int2Integer# 0# in putStrLn "" - - -int2Integer# :: Int# -> (# Int#, ByteArray# #) -int2Integer# = undefined --- This function doesn't have to work! --- We just need it for its type. - diff --git a/testsuite/tests/typecheck/should_fail/tcfail141.stderr b/testsuite/tests/typecheck/should_fail/tcfail141.stderr deleted file mode 100644 index 27c7ede212..0000000000 --- a/testsuite/tests/typecheck/should_fail/tcfail141.stderr +++ /dev/null @@ -1,7 +0,0 @@ - -tcfail141.hs:10:12: - The variable `f' cannot have an unboxed tuple type: - (# Int#, ByteArray# #) - In the expression: let f = int2Integer# 0# in putStrLn "" - In an equation for `main': - main = let f = int2Integer# 0# in putStrLn "" diff --git a/testsuite/tests/typecheck/should_fail/tcfail159.stderr b/testsuite/tests/typecheck/should_fail/tcfail159.stderr index 0556582417..c809e39d89 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail159.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail159.stderr @@ -1,8 +1,8 @@ tcfail159.hs:9:11: - Couldn't match kind `*' against `(#)' + Couldn't match kind `*' against `#' Kind incompatibility when matching types: t0 :: * - (# Int, Int #) :: (#) + (# Int, Int #) :: # In the pattern: ~(# p, q #) In a case alternative: ~(# p, q #) -> p diff --git a/testsuite/tests/typecheck/should_run/T5573a.hs b/testsuite/tests/typecheck/should_run/T5573a.hs new file mode 100644 index 0000000000..5f77b580ba --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T5573a.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE MagicHash, UnboxedTuples, BangPatterns #-} +module Main where + +import GHC.Exts + +{-# NOINLINE foo1 #-} -- Make it harder to get right +foo1 x = (# x,x #) + +{-# NOINLINE foo2 #-} -- Make it harder to get right +foo2 x = (# x, (# True, False #) #) + +{-# NOINLINE foo3 #-} -- Make it harder to get right +foo3 (# x,y #) = x + +main = print $ foo3 (# if b then x + y else x - y, 30 #) + where (# x, _ #) = foo1 10 + (# y, (# b, _ #) #) = foo2 20 diff --git a/testsuite/tests/typecheck/should_run/T5573a.stdout b/testsuite/tests/typecheck/should_run/T5573a.stdout new file mode 100644 index 0000000000..64bb6b746d --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T5573a.stdout @@ -0,0 +1 @@ +30 diff --git a/testsuite/tests/typecheck/should_run/T5573b.hs b/testsuite/tests/typecheck/should_run/T5573b.hs new file mode 100644 index 0000000000..f46b7cf1a0 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T5573b.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE MagicHash, UnboxedTuples, BangPatterns #-} +module Main where + +import GHC.Exts + +{-# NOINLINE foo #-} -- Make it harder to get right +foo :: Double# -> (# (# Double#, Double# #), Double# #) +foo x = (# (# x, x #), x #) + +main :: IO () +main = case foo 1.0## of + (# (# x, y #), z #) -> print (D# x + D# y + D# z) diff --git a/testsuite/tests/typecheck/should_run/T5573b.stdout b/testsuite/tests/typecheck/should_run/T5573b.stdout new file mode 100644 index 0000000000..9f55b2ccb5 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T5573b.stdout @@ -0,0 +1 @@ +3.0 diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index 5058c220ec..fb548995a5 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -70,6 +70,11 @@ test('tcrun043', normal, compile_and_run, ['']) test('tcrun044', normal, compile_and_run, ['']) test('tcrun045', normal, compile_and_run, ['']) test('tcrun046', normal, compile_and_run, ['']) +test('tcrun047', compose(omit_ways(['ghci']),only_compiler_types(['ghc'])), compile_and_run, ['']) +test('tcrun048', compose(omit_ways(['ghci']),only_compiler_types(['ghc'])), compile_and_run, ['']) +test('tcrun049', compose(omit_ways(['ghci']),only_compiler_types(['ghc'])), compile_and_run, ['']) +test('tcrun050', compose(omit_ways(['ghci']),only_compiler_types(['ghc'])), compile_and_run, ['']) +test('tcrun051', compose(omit_ways(['ghci']),only_compiler_types(['ghc'])), compile_and_run, ['']) test('church', normal, compile_and_run, ['']) test('testeq2', normal, compile_and_run, ['']) @@ -87,3 +92,5 @@ test('T4809', reqlib('mtl'), compile_and_run, ['']) test('T2722', normal, compile_and_run, ['']) test('mc17', normal, compile_and_run, ['']) test('T5759', normal, compile_and_run, ['']) +test('T5573a', compose(omit_ways(['ghci']),only_compiler_types(['ghc'])), compile_and_run, ['']) +test('T5573b', compose(omit_ways(['ghci']),only_compiler_types(['ghc'])), compile_and_run, ['']) diff --git a/testsuite/tests/typecheck/should_run/tcrun047.hs b/testsuite/tests/typecheck/should_run/tcrun047.hs new file mode 100644 index 0000000000..5f6948e9cd --- /dev/null +++ b/testsuite/tests/typecheck/should_run/tcrun047.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE UnboxedTuples #-} + +-- !!! Check that unboxed tuples can be function arguments +module Main where + +data Ex = Ex (# Int,Int #) + +{-# NOINLINE f #-} -- Make it harder to get right +f :: (# Int,Int #) -> Int +f x = error "urk" + +{-# NOINLINE g #-} -- Make it harder to get right +g (Ex (# x,y #)) = x + + +main = print $ g (Ex (# 10, f (# 20, 30 #) #))
\ No newline at end of file diff --git a/testsuite/tests/typecheck/should_run/tcrun047.stdout b/testsuite/tests/typecheck/should_run/tcrun047.stdout new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/testsuite/tests/typecheck/should_run/tcrun047.stdout @@ -0,0 +1 @@ +10 diff --git a/testsuite/tests/typecheck/should_run/tcrun048.hs b/testsuite/tests/typecheck/should_run/tcrun048.hs new file mode 100644 index 0000000000..57308c3aaa --- /dev/null +++ b/testsuite/tests/typecheck/should_run/tcrun048.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE MagicHash, UnboxedTuples #-} + +module Main where + +import GHC.Prim (Int#, Double#) + +main :: IO () +main = let f = int2Integer# 0# in putStrLn "" + + +{-# NOINLINE int2Integer# #-} +int2Integer# :: Int# -> (# Int#, Double# #) +int2Integer# x = (# x, 1.0## #) diff --git a/testsuite/tests/typecheck/should_run/tcrun048.stdout b/testsuite/tests/typecheck/should_run/tcrun048.stdout new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/tcrun048.stdout @@ -0,0 +1 @@ + diff --git a/testsuite/tests/typecheck/should_run/tcrun049.hs b/testsuite/tests/typecheck/should_run/tcrun049.hs new file mode 100644 index 0000000000..29372a8792 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/tcrun049.hs @@ -0,0 +1,12 @@ + +{-# LANGUAGE UnboxedTuples #-} + +module Main where + +type T a = Int -> (# Int, Int #) + +{-# NOINLINE f2 #-} +f2 :: T a -> T a +f2 t = \x -> case t x of _ -> (# 3,4 #) -- NB: wildcard has unboxed tuple type + +main = print $ case f2 (\x -> (# x, x + 1 #)) 10 of (# y, z #) -> y + z
\ No newline at end of file diff --git a/testsuite/tests/typecheck/should_run/tcrun049.stdout b/testsuite/tests/typecheck/should_run/tcrun049.stdout new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/tcrun049.stdout @@ -0,0 +1 @@ +7 diff --git a/testsuite/tests/typecheck/should_run/tcrun050.hs b/testsuite/tests/typecheck/should_run/tcrun050.hs new file mode 100644 index 0000000000..a401348439 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/tcrun050.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE UnboxedTuples #-} + +module Main where + +type T a = Int -> (# Int, Int #) + +{-# NOINLINE g #-} +--g :: (# Int, Int #) -> (# Int, Int #) +g t = case t of r -> (r :: (# Int, Int #)) + +{-# NOINLINE f #-} +f :: T a -> T a +f t = \x -> case t x of r -> r + + +main = print $ case f (\x -> g (# x, x + 1 #)) 10 of (# y, z #) -> y + z
\ No newline at end of file diff --git a/testsuite/tests/typecheck/should_run/tcrun050.stdout b/testsuite/tests/typecheck/should_run/tcrun050.stdout new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/tcrun050.stdout @@ -0,0 +1 @@ +21 diff --git a/testsuite/tests/typecheck/should_run/tcrun051.hs b/testsuite/tests/typecheck/should_run/tcrun051.hs new file mode 100644 index 0000000000..23201d2593 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/tcrun051.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE UnboxedTuples #-} + +module Main where + +-- Tests unboxed tuple slow calls + +{-# NOINLINE g #-} +g :: Int -> (# Int, Int #) -> Int -> (# Int, (# Int #) #) -> (# #) -> Int +g a (# b, c #) d (# e, (# f #) #) (# #) = a + b + c + d + e + f + +{-# NOINLINE h #-} +h :: (Int -> (# Int, Int #) -> Int -> (# Int, (# Int #) #) -> (# #) -> Int) -> (Int, Int) +h g = (g5, g5') + where + -- Apply all the arguments at once + g5' = g 1 (# 2, 3 #) 4 (# 5, (# 6 #) #) (# #) + + -- Try to force argument-at-a-time application as a stress-test + g1 = g 1 + g2 = g1 `seq` g1 (# 2, 3 #) + g3 = g2 `seq` g2 4 + g4 = g3 `seq` g3 (# 5, (# 6 #) #) + g5 = g4 `seq` g4 (# #) + + +main = print $ h g
\ No newline at end of file diff --git a/testsuite/tests/typecheck/should_run/tcrun051.stdout b/testsuite/tests/typecheck/should_run/tcrun051.stdout new file mode 100644 index 0000000000..905a9fe56b --- /dev/null +++ b/testsuite/tests/typecheck/should_run/tcrun051.stdout @@ -0,0 +1 @@ +(21,21) |