Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Testsuite update for unboxed tuples in arguments

  • Loading branch information...
commit 5b5c144203d1a8c6f0a733d1d713ad2f87ce50bf 1 parent b757825
@batterseapower batterseapower authored
Showing with 129 additions and 170 deletions.
  1. +6 −0 .gitignore
  2. +20 −20 tests/ghci.debugger/scripts/break026.stdout
  3. +3 −3 tests/typecheck/should_compile/tc141.stderr
  4. +0 −16 tests/typecheck/should_fail/T5573a.hs
  5. +0 −16 tests/typecheck/should_fail/T5573a.stderr
  6. +0 −8 tests/typecheck/should_fail/T5573b.hs
  7. +0 −7 tests/typecheck/should_fail/T5573b.stderr
  8. +0 −6 tests/typecheck/should_fail/all.T
  9. +0 −13 tests/typecheck/should_fail/tcfail087.hs
  10. +0 −7 tests/typecheck/should_fail/tcfail087.stderr
  11. +0 −13 tests/typecheck/should_fail/tcfail115.hs
  12. +0 −14 tests/typecheck/should_fail/tcfail115.stderr
  13. +0 −14 tests/typecheck/should_fail/tcfail120.hs
  14. +0 −7 tests/typecheck/should_fail/tcfail120.stderr
  15. +0 −17 tests/typecheck/should_fail/tcfail141.hs
  16. +0 −7 tests/typecheck/should_fail/tcfail141.stderr
  17. +2 −2 tests/typecheck/should_fail/tcfail159.stderr
  18. +17 −0 tests/typecheck/should_run/T5573a.hs
  19. +1 −0  tests/typecheck/should_run/T5573a.stdout
  20. +12 −0 tests/typecheck/should_run/T5573b.hs
  21. +1 −0  tests/typecheck/should_run/T5573b.stdout
  22. +6 −0 tests/typecheck/should_run/all.T
  23. +16 −0 tests/typecheck/should_run/tcrun047.hs
  24. +1 −0  tests/typecheck/should_run/tcrun047.stdout
  25. +13 −0 tests/typecheck/should_run/tcrun048.hs
  26. +1 −0  tests/typecheck/should_run/tcrun048.stdout
  27. +12 −0 tests/typecheck/should_run/tcrun049.hs
  28. +1 −0  tests/typecheck/should_run/tcrun049.stdout
  29. +16 −0 tests/typecheck/should_run/tcrun050.hs
  30. +1 −0  tests/typecheck/should_run/tcrun050.stdout
View
6 .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,10 @@ 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/testeq2
tests/typecheck/testeq1/typecheck.testeq1
View
40 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
View
6 tests/typecheck/should_compile/tc141.stderr
@@ -29,11 +29,11 @@ tc141.hs:13:13:
in v
tc141.hs:15:18:
- Couldn't match expected type `a1' with actual type `t1'
+ Couldn't match expected type `a1' with actual type `t'
`a1' is a rigid type variable bound by
the type signature for v :: a1 at tc141.hs:14:19
- `t1' is a rigid type variable bound by
- the inferred type of g :: t -> t1 -> a at tc141.hs:13:1
+ `t' is a rigid type variable bound by
+ the inferred type of g :: t1 -> t -> a at tc141.hs:13:1
In the expression: b
In an equation for `v': v = b
In the expression:
View
16 tests/typecheck/should_fail/T5573a.hs
@@ -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
-
-
View
16 tests/typecheck/should_fail/T5573a.stderr
@@ -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
View
8 tests/typecheck/should_fail/T5573b.hs
@@ -1,8 +0,0 @@
-{-# LANGUAGE MagicHash, UnboxedTuples, BangPatterns #-}
-module T5573b where
-
-import GHC.Exts
-
-foo :: Double# -> (# (# Double#, Double# #), Double# #)
-foo x = (# (# x, x #), x #)
-
View
7 tests/typecheck/should_fail/T5573b.stderr
@@ -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# #)
View
6 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,7 +262,5 @@ 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('T5689', normal, compile_fail, [''])
test('T5684', normal, compile_fail, [''])
View
13 tests/typecheck/should_fail/tcfail087.hs
@@ -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
-
-
View
7 tests/typecheck/should_fail/tcfail087.stderr
@@ -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 type declaration for `Ex'
View
13 tests/typecheck/should_fail/tcfail115.hs
@@ -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
-
View
14 tests/typecheck/should_fail/tcfail115.stderr
@@ -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 }
View
14 tests/typecheck/should_fail/tcfail120.hs
@@ -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 #)
-
View
7 tests/typecheck/should_fail/tcfail120.stderr
@@ -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 #) }
View
17 tests/typecheck/should_fail/tcfail141.hs
@@ -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.
-
View
7 tests/typecheck/should_fail/tcfail141.stderr
@@ -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 ""
View
4 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
View
17 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
View
1  tests/typecheck/should_run/T5573a.stdout
@@ -0,0 +1 @@
+30
View
12 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)
View
1  tests/typecheck/should_run/T5573b.stdout
@@ -0,0 +1 @@
+3.0
View
6 tests/typecheck/should_run/all.T
@@ -70,6 +70,10 @@ 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('church', normal, compile_and_run, [''])
test('testeq2', normal, compile_and_run, [''])
@@ -87,3 +91,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, [''])
View
16 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 #) #))
View
1  tests/typecheck/should_run/tcrun047.stdout
@@ -0,0 +1 @@
+10
View
13 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## #)
View
1  tests/typecheck/should_run/tcrun048.stdout
@@ -0,0 +1 @@
+
View
12 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
View
1  tests/typecheck/should_run/tcrun049.stdout
@@ -0,0 +1 @@
+7
View
16 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
View
1  tests/typecheck/should_run/tcrun050.stdout
@@ -0,0 +1 @@
+21
Please sign in to comment.
Something went wrong with that request. Please try again.