diff options
Diffstat (limited to 'testsuite/tests/typecheck/should_compile')
12 files changed, 193 insertions, 184 deletions
diff --git a/testsuite/tests/typecheck/should_compile/FD1.stderr b/testsuite/tests/typecheck/should_compile/FD1.stderr index 661bbcd9aa..19d698294a 100644 --- a/testsuite/tests/typecheck/should_compile/FD1.stderr +++ b/testsuite/tests/typecheck/should_compile/FD1.stderr @@ -1,9 +1,10 @@ -
-FD1.hs:16:1:
- Couldn't match expected type ‘Int -> Int’ with actual type ‘a’
- ‘a’ is a rigid type variable bound by
- the type signature for: plus :: E a (Int -> Int) => Int -> a
- at FD1.hs:15:9
- The equation(s) for ‘plus’ have two arguments,
- but its type ‘Int -> a’ has only one
- Relevant bindings include plus :: Int -> a (bound at FD1.hs:16:1)
+ +FD1.hs:16:1: error: + • Couldn't match expected type ‘Int -> Int’ with actual type ‘a’ + ‘a’ is a rigid type variable bound by + the type signature for: + plus :: forall a. E a (Int -> Int) => Int -> a + at FD1.hs:15:9 + • The equation(s) for ‘plus’ have two arguments, + but its type ‘Int -> a’ has only one + • Relevant bindings include plus :: Int -> a (bound at FD1.hs:16:1) diff --git a/testsuite/tests/typecheck/should_compile/FD2.stderr b/testsuite/tests/typecheck/should_compile/FD2.stderr index 590c9b6520..93997c52ec 100644 --- a/testsuite/tests/typecheck/should_compile/FD2.stderr +++ b/testsuite/tests/typecheck/should_compile/FD2.stderr @@ -1,19 +1,19 @@ -
-FD2.hs:26:34:
- Couldn't match expected type ‘e1’ with actual type ‘e’
- ‘e’ is a rigid type variable bound by
- the type signature for:
- foldr1 :: Elem a e => (e -> e -> e) -> a -> e
- at FD2.hs:21:13
- ‘e1’ is a rigid type variable bound by
- the type signature for:
- mf :: Elem a e1 => e1 -> Maybe e1 -> Maybe e1
- at FD2.hs:24:18
- In the first argument of ‘Just’, namely ‘(f x y)’
- In the expression: Just (f x y)
- Relevant bindings include
- y :: e1 (bound at FD2.hs:26:23)
- x :: e1 (bound at FD2.hs:26:15)
- mf :: e1 -> Maybe e1 -> Maybe e1 (bound at FD2.hs:25:12)
- f :: e -> e -> e (bound at FD2.hs:22:10)
- foldr1 :: (e -> e -> e) -> a -> e (bound at FD2.hs:22:3)
+ +FD2.hs:26:34: error: + • Couldn't match expected type ‘e1’ with actual type ‘e’ + ‘e’ is a rigid type variable bound by + the type signature for: + foldr1 :: forall e. Elem a e => (e -> e -> e) -> a -> e + at FD2.hs:21:13 + ‘e1’ is a rigid type variable bound by + the type signature for: + mf :: forall e1. Elem a e1 => e1 -> Maybe e1 -> Maybe e1 + at FD2.hs:24:18 + • In the first argument of ‘Just’, namely ‘(f x y)’ + In the expression: Just (f x y) + • Relevant bindings include + y :: e1 (bound at FD2.hs:26:23) + x :: e1 (bound at FD2.hs:26:15) + mf :: e1 -> Maybe e1 -> Maybe e1 (bound at FD2.hs:25:12) + f :: e -> e -> e (bound at FD2.hs:22:10) + foldr1 :: (e -> e -> e) -> a -> e (bound at FD2.hs:22:3) diff --git a/testsuite/tests/typecheck/should_compile/FD3.stderr b/testsuite/tests/typecheck/should_compile/FD3.stderr index 8d3c33fcaf..f0dafbe47c 100644 --- a/testsuite/tests/typecheck/should_compile/FD3.stderr +++ b/testsuite/tests/typecheck/should_compile/FD3.stderr @@ -1,14 +1,15 @@ FD3.hs:15:15: error: - Couldn't match type ‘a’ with ‘(String, a)’ - arising from a functional dependency between: - constraint ‘MkA (String, a) a’ arising from a use of ‘mkA’ - instance ‘MkA a1 a1’ at FD3.hs:12:10-16 - ‘a’ is a rigid type variable bound by - the type signature for: translate :: (String, a) -> A a + • Couldn't match type ‘a’ with ‘(String, a)’ + arising from a functional dependency between: + constraint ‘MkA (String, a) a’ arising from a use of ‘mkA’ + instance ‘MkA a1 a1’ at FD3.hs:12:10-16 + ‘a’ is a rigid type variable bound by + the type signature for: + translate :: forall a. (String, a) -> A a at FD3.hs:14:14 - In the expression: mkA a - In an equation for ‘translate’: translate a = mkA a - Relevant bindings include - a :: (String, a) (bound at FD3.hs:15:11) - translate :: (String, a) -> A a (bound at FD3.hs:15:1) + • In the expression: mkA a + In an equation for ‘translate’: translate a = mkA a + • Relevant bindings include + a :: (String, a) (bound at FD3.hs:15:11) + translate :: (String, a) -> A a (bound at FD3.hs:15:1) diff --git a/testsuite/tests/typecheck/should_compile/T10632.stderr b/testsuite/tests/typecheck/should_compile/T10632.stderr index 81377b3364..5a6809de5c 100644 --- a/testsuite/tests/typecheck/should_compile/T10632.stderr +++ b/testsuite/tests/typecheck/should_compile/T10632.stderr @@ -1,4 +1,5 @@ - -T10632.hs:3:6: warning: - Redundant constraint: ?file1::String - In the type signature for: f :: (?file1::String) => IO () +
+T10632.hs:3:1: warning:
+ Redundant constraint: ?file1::String
+ In the type signature for:
+ f :: (?file1::String) => IO ()
diff --git a/testsuite/tests/typecheck/should_compile/T7220a.stderr b/testsuite/tests/typecheck/should_compile/T7220a.stderr index ea0331b3dc..b728a1e8d9 100644 --- a/testsuite/tests/typecheck/should_compile/T7220a.stderr +++ b/testsuite/tests/typecheck/should_compile/T7220a.stderr @@ -1,14 +1,14 @@ - -T7220a.hs:17:6: - Could not deduce (C a b) - from the context: (C a0 b, TF b ~ Y) - bound by the type signature for: f :: (C a0 b, TF b ~ Y) => b - at T7220a.hs:17:6-44 - Possible fix: - add (C a b) to the context of - the type signature for: f :: (C a0 b, TF b ~ Y) => b - In the ambiguity check for the type signature for ‘f’: - f :: forall a. (forall b. (C a b, TF b ~ Y) => b) -> X - To defer the ambiguity check to use sites, enable AllowAmbiguousTypes - In the type signature for ‘f’: - f :: (forall b. (C a b, TF b ~ Y) => b) -> X +
+T7220a.hs:17:6: error:
+ Could not deduce (C a b)
+ from the context: (C a0 b, TF b ~ Y)
+ bound by the type signature for:
+ f :: (C a0 b, TF b ~ Y) => b
+ at T7220a.hs:17:6-44
+ Possible fix:
+ add (C a b) to the context of
+ the type signature for:
+ f :: (C a0 b, TF b ~ Y) => b
+ In the ambiguity check for ‘f’
+ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
+ In the type signature: f :: (forall b. (C a b, TF b ~ Y) => b) -> X
diff --git a/testsuite/tests/typecheck/should_compile/T9834.stderr b/testsuite/tests/typecheck/should_compile/T9834.stderr index c49e49bb9d..3ce53a0c51 100644 --- a/testsuite/tests/typecheck/should_compile/T9834.stderr +++ b/testsuite/tests/typecheck/should_compile/T9834.stderr @@ -1,8 +1,8 @@ -T9834.hs:23:10: Warning:
+T9834.hs:23:10: warning:
Couldn't match type ‘p’ with ‘(->) (p a0)’
- ‘p’ is a rigid type variable bound by
- the class declaration for ‘ApplicativeFix’ at T9834.hs:21:39
+ ‘p’ is a rigid type variable bound by
+ the class declaration for ‘ApplicativeFix’ at T9834.hs:21:39
Expected type: (forall (q :: * -> *).
Applicative q =>
Comp p q a -> Comp p q a)
@@ -20,15 +20,14 @@ T9834.hs:23:10: Warning: -> p a
(bound at T9834.hs:23:3)
-T9834.hs:23:10: Warning:
+T9834.hs:23:10: warning:
Couldn't match type ‘a’ with ‘p a0’
- ‘a’ is a rigid type variable bound by
- the type signature for:
- afix :: (forall (q :: * -> *).
- Applicative q =>
- Comp p q a -> Comp p q a)
- -> p a
- at T9834.hs:22:11
+ ‘a’ is a rigid type variable bound by
+ the type signature for:
+ afix :: forall a.
+ (forall (q :: * -> *). Applicative q => Comp p q a -> Comp p q a)
+ -> p a
+ at T9834.hs:22:11
Expected type: (forall (q :: * -> *).
Applicative q =>
Comp p q a -> Comp p q a)
@@ -46,19 +45,20 @@ T9834.hs:23:10: Warning: -> p a
(bound at T9834.hs:23:3)
-T9834.hs:23:10: Warning:
+T9834.hs:23:10: warning:
Couldn't match type ‘a’ with ‘a1’
- ‘a’ is a rigid type variable bound by
- the type signature for:
- afix :: (forall (q :: * -> *).
- Applicative q =>
- Comp p q a -> Comp p q a)
- -> p a
- at T9834.hs:22:11
- ‘a1’ is a rigid type variable bound by
- a type expected by the context:
- Applicative q => Comp p q a1 -> Comp p q a1
- at T9834.hs:23:10
+ ‘a’ is a rigid type variable bound by
+ the type signature for:
+ afix :: forall a.
+ (forall (q :: * -> *). Applicative q => Comp p q a -> Comp p q a)
+ -> p a
+ at T9834.hs:22:11
+ ‘a1’ is a rigid type variable bound by
+ a type expected by the context:
+ forall (q :: * -> *) a1.
+ Applicative q =>
+ Comp p q a1 -> Comp p q a1
+ at T9834.hs:23:10
Expected type: Comp p q a1 -> Comp p q a1
Actual type: Comp p q a -> Comp p q a
In the expression: wrapIdComp
diff --git a/testsuite/tests/typecheck/should_compile/T9939.stderr b/testsuite/tests/typecheck/should_compile/T9939.stderr index eda780ae0e..86decf0a5e 100644 --- a/testsuite/tests/typecheck/should_compile/T9939.stderr +++ b/testsuite/tests/typecheck/should_compile/T9939.stderr @@ -1,18 +1,20 @@ - -T9939.hs:5:7: Warning: - Redundant constraint: Eq a - In the type signature for: f1 :: (Eq a, Ord a) => a -> a -> Bool - -T9939.hs:9:7: Warning: - Redundant constraint: Eq a - In the type signature for: f2 :: (Eq a, Ord a) => a -> a -> Bool - -T9939.hs:13:7: Warning: - Redundant constraint: Eq b - In the type signature for: - f3 :: (Eq a, a ~ b, Eq b) => a -> b -> Bool - -T9939.hs:20:7: Warning: - Redundant constraint: Eq b - In the type signature for: - f4 :: (Eq a, Eq b) => a -> b -> Equal a b -> Bool +
+T9939.hs:5:1: warning:
+ Redundant constraint: Eq a
+ In the type signature for:
+ f1 :: (Eq a, Ord a) => a -> a -> Bool
+
+T9939.hs:9:1: warning:
+ Redundant constraint: Eq a
+ In the type signature for:
+ f2 :: (Eq a, Ord a) => a -> a -> Bool
+
+T9939.hs:13:1: warning:
+ Redundant constraint: Eq b
+ In the type signature for:
+ f3 :: (Eq a, a ~ b, Eq b) => a -> b -> Bool
+
+T9939.hs:20:1: warning:
+ Redundant constraint: Eq b
+ In the type signature for:
+ f4 :: (Eq a, Eq b) => a -> b -> Equal a b -> Bool
diff --git a/testsuite/tests/typecheck/should_compile/tc141.stderr b/testsuite/tests/typecheck/should_compile/tc141.stderr index 933eb03f55..b5ee77b689 100644 --- a/testsuite/tests/typecheck/should_compile/tc141.stderr +++ b/testsuite/tests/typecheck/should_compile/tc141.stderr @@ -1,46 +1,48 @@ -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:12: error: + • 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’ - because type variable ‘a1’ would escape its scope - This (rigid, skolem) type variable is bound by - an expression type signature: a1 - at tc141.hs:11:31-34 - In the expression: q :: a - In the expression: (q :: a, p) - Relevant bindings include - p :: a (bound at tc141.hs:11:12) - q :: a (bound at tc141.hs:11:17) - x :: (a, a) (bound at tc141.hs:11:3) - f :: (a, a) -> (t, a) (bound at tc141.hs:11:1) +tc141.hs:11:31: error: + • Couldn't match expected type ‘a1’ with actual type ‘a’ + because type variable ‘a1’ would escape its scope + This (rigid, skolem) type variable is bound by + an expression type signature: + a1 + at tc141.hs:11:31-34 + • In the expression: q :: a + In the expression: (q :: a, p) + • Relevant bindings include + p :: a (bound at tc141.hs:11:12) + q :: a (bound at tc141.hs:11:17) + x :: (a, a) (bound at tc141.hs:11:3) + f :: (a, a) -> (t, a) (bound at tc141.hs:11:1) -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:13:13: error: + • 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’ - because type variable ‘a2’ would escape its scope - This (rigid, skolem) type variable is bound by - the type signature for: v :: a2 - at tc141.hs:14:19 - In the expression: b - In an equation for ‘v’: v = b - Relevant bindings include - v :: a2 (bound at tc141.hs:15:14) - b :: t (bound at tc141.hs:13:5) - g :: a -> t -> a1 (bound at tc141.hs:13:1) +tc141.hs:15:18: error: + • Couldn't match expected type ‘a2’ with actual type ‘t’ + because type variable ‘a2’ would escape its scope + This (rigid, skolem) type variable is bound by + the type signature for: + v :: a2 + at tc141.hs:14:14-19 + • In the expression: b + In an equation for ‘v’: v = b + • Relevant bindings include + v :: a2 (bound at tc141.hs:15:14) + b :: t (bound at tc141.hs:13:5) + g :: a -> t -> a1 (bound at tc141.hs:13:1) diff --git a/testsuite/tests/typecheck/should_compile/tc166.hs b/testsuite/tests/typecheck/should_compile/tc166.hs index 75ea65c650..5739a347c8 100644 --- a/testsuite/tests/typecheck/should_compile/tc166.hs +++ b/testsuite/tests/typecheck/should_compile/tc166.hs @@ -14,9 +14,9 @@ module ShouldCompile where instance C Char a Bool data P t a = forall b. (C t a b) => MkP b - + data Q t = MkQ (forall a. P t a) - + f1 :: Q Char f1 = MkQ (MkP True) diff --git a/testsuite/tests/typecheck/should_compile/tc168.stderr b/testsuite/tests/typecheck/should_compile/tc168.stderr index 4eca08f17c..7d992a48a0 100644 --- a/testsuite/tests/typecheck/should_compile/tc168.stderr +++ b/testsuite/tests/typecheck/should_compile/tc168.stderr @@ -1,10 +1,12 @@ - -tc168.hs:17:1: - Could not deduce (C a1 (a, b0)) - from the context: C a1 (a, b) - bound by the inferred type for ‘g’: C a1 (a, b) => a1 -> a - at tc168.hs:17:1-16 - The type variable ‘b0’ is ambiguous - When checking that ‘g’ has the inferred type - g :: forall a b a1. C a1 (a, b) => a1 -> a - Probable cause: the inferred type is ambiguous +
+tc168.hs:17:1: error:
+ Could not deduce (C a1 (a, b0))
+ from the context: C a1 (a, b)
+ bound by the inferred type for ‘g’:
+ C a1 (a, b) => a1 -> a
+ at tc168.hs:17:1-16
+ The type variable ‘b0’ is ambiguous
+ In the ambiguity check for the inferred type for ‘g’
+ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
+ When checking the inferred type
+ g :: forall a b a1. C a1 (a, b) => a1 -> a
diff --git a/testsuite/tests/typecheck/should_compile/tc182.hs b/testsuite/tests/typecheck/should_compile/tc182.hs index f6e9164f47..00b3f724de 100644 --- a/testsuite/tests/typecheck/should_compile/tc182.hs +++ b/testsuite/tests/typecheck/should_compile/tc182.hs @@ -9,5 +9,3 @@ data (Show a) => Obs a = forall b. LiftObs a b f :: Show a => Obs a -> String f (LiftObs _ _) = "yes" - - diff --git a/testsuite/tests/typecheck/should_compile/tc244.hs b/testsuite/tests/typecheck/should_compile/tc244.hs index 4c5468809a..196f6e0990 100644 --- a/testsuite/tests/typecheck/should_compile/tc244.hs +++ b/testsuite/tests/typecheck/should_compile/tc244.hs @@ -1,30 +1,32 @@ -{-# LANGUAGE TypeFamilies, GADTs #-}
-
--- Tests record update in the presence of
--- existentials, GADTs, type families
-
-module Rec where
-
------------------ Existential
-data S a where
- S1 :: { fs1 :: a, fs2 :: b } -> S a
- S2 :: { fs1 :: a } -> S a
-
-updS s x = s { fs1=x }
-
------------------- GADT
-data T a b where
- T1 :: { ft1 :: a, ft2 :: c, ft3 :: d } -> T a Int
- T2 :: { ft1 :: a, ft3 :: c } -> T a Int
- T3 :: T Int b
-
-f :: T a1 b -> a2 -> T a2 b
-f x v = x { ft1 = v }
-
------------------- Type family
-data family R a
-data instance R (a,b) where
- R1 :: { fr1 :: a, fr2 :: b, fr3 :: c } -> R (a,b)
- R2 :: { fr1 :: a, fr3 :: c } -> R (a,b)
-
-updR r x = r { fr1=x }
+{-# LANGUAGE TypeFamilies, GADTs #-} + +-- Tests record update in the presence of +-- existentials, GADTs, type families + +module Rec where + +----------------- Existential +data S a where + S1 :: { fs1 :: a, fs2 :: b } -> S a + S2 :: { fs1 :: a } -> S a + +updS s x = s { fs1=x } + +{- +------------------ GADT +data T a b where + T1 :: { ft1 :: a, ft2 :: c, ft3 :: d } -> T a Int + T2 :: { ft1 :: a, ft3 :: c } -> T a Int + T3 :: T Int b + +f :: T a1 b -> a2 -> T a2 b +f x v = x { ft1 = v } + +------------------ Type family +data family R a +data instance R (a,b) where + R1 :: { fr1 :: a, fr2 :: b, fr3 :: c } -> R (a,b) + R2 :: { fr1 :: a, fr3 :: c } -> R (a,b) + +updR r x = r { fr1=x } +-} |