diff options
Diffstat (limited to 'testsuite/tests/typecheck/should_fail')
41 files changed, 240 insertions, 126 deletions
diff --git a/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr b/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr index 255b3ad702..6345e2ab1c 100644 --- a/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr +++ b/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr @@ -1,6 +1,9 @@ FrozenErrorTests.hs:26:9: error: • Couldn't match type ‘a’ with ‘[a]’ arising from a use of ‘goo1’ + ‘a’ is a rigid type variable bound by + the inferred type of test1 :: a + at FrozenErrorTests.hs:26:1-28 • In the expression: goo1 False undefined In an equation for ‘test1’: test1 = goo1 False undefined • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_fail/T12177.stderr b/testsuite/tests/typecheck/should_fail/T12177.stderr index 0c810f4185..16056e3e27 100644 --- a/testsuite/tests/typecheck/should_fail/T12177.stderr +++ b/testsuite/tests/typecheck/should_fail/T12177.stderr @@ -4,9 +4,9 @@ T12177.hs:3:19: error: Where: ‘t’ is a rigid type variable bound by the inferred type of bar :: p -> p1 -> t at T12177.hs:3:1-19 - • In the expression: _ - In the expression: \ x -> _ + • In the expression: \ x -> _ In the expression: \ x -> \ x -> _ + In an equation for ‘bar’: bar = \ x -> \ x -> _ • Relevant bindings include x :: p1 (bound at T12177.hs:3:14) bar :: p -> p1 -> t (bound at T12177.hs:3:1) @@ -16,9 +16,9 @@ T12177.hs:5:37: error: Where: ‘t’ is a rigid type variable bound by the inferred type of baz :: p -> p1 -> p2 -> p3 -> p4 -> t at T12177.hs:5:1-37 - • In the expression: _ - In the expression: \ z -> _ + • In the expression: \ z -> _ In the expression: \ x -> \ z -> _ + In the expression: \ z -> \ x -> \ z -> ... • Relevant bindings include z :: p4 (bound at T12177.hs:5:32) x :: p3 (bound at T12177.hs:5:26) diff --git a/testsuite/tests/typecheck/should_fail/T14884.stderr b/testsuite/tests/typecheck/should_fail/T14884.stderr index e1738891a7..c901811f6f 100644 --- a/testsuite/tests/typecheck/should_fail/T14884.stderr +++ b/testsuite/tests/typecheck/should_fail/T14884.stderr @@ -2,8 +2,7 @@ T14884.hs:4:5: error: • Found hole: _ :: (a0 -> IO ()) -> String -> IO () Where: ‘a0’ is an ambiguous type variable - • In the expression: _ - In the expression: _ print "abc" + • In the expression: _ print "abc" In an equation for ‘x’: x = _ print "abc" • Relevant bindings include x :: IO () (bound at T14884.hs:4:1) Valid hole fits include diff --git a/testsuite/tests/typecheck/should_fail/T14904a.stderr b/testsuite/tests/typecheck/should_fail/T14904a.stderr index c0e2b84a80..3b8d005bab 100644 --- a/testsuite/tests/typecheck/should_fail/T14904a.stderr +++ b/testsuite/tests/typecheck/should_fail/T14904a.stderr @@ -1,7 +1,8 @@ T14904a.hs:9:6: error: - • Expected kind ‘forall (a :: k1). g a’, but ‘f’ has kind ‘k0’ - Cannot instantiate unification variable ‘k0’ - with a kind involving polytypes: forall (a :: k1). g a + • Expected kind ‘forall (a :: k). g a’, but ‘f’ has kind ‘k1’ + ‘k1’ is a rigid type variable bound by + a family instance declaration + at T14904a.hs:9:3-30 • In the first argument of ‘F’, namely ‘(f :: forall a. g a)’ In the type family declaration for ‘F’ diff --git a/testsuite/tests/typecheck/should_fail/T15799.stderr b/testsuite/tests/typecheck/should_fail/T15799.stderr index f93e043471..4e6d7b4dfd 100644 --- a/testsuite/tests/typecheck/should_fail/T15799.stderr +++ b/testsuite/tests/typecheck/should_fail/T15799.stderr @@ -2,6 +2,3 @@ T15799.hs:46:62: error: • Expected kind ‘Op Nat’, but ‘UnOp b’ has kind ‘Nat’ • In the first argument of ‘(<=)’, namely ‘UnOp b’ - -T15799.hs:46:62: error: - Expected a constraint, but ‘UnOp b <= a’ has kind ‘*’ diff --git a/testsuite/tests/typecheck/should_fail/T15807.stderr b/testsuite/tests/typecheck/should_fail/T15807.stderr index 809398ade0..bac4b5596e 100644 --- a/testsuite/tests/typecheck/should_fail/T15807.stderr +++ b/testsuite/tests/typecheck/should_fail/T15807.stderr @@ -1,6 +1,9 @@ -T15807.hs:12:12: error: - • Expected kind ‘f -> *’, but ‘f’ has kind ‘*’ - • In the type ‘f a’ - In the definition of data constructor ‘MkApp’ +T15807.hs:12:3: error: + • Cannot generalise type; skolem ‘f’ would escape its scope + if I tried to quantify (f0 :: f -> *) in this type: + forall f (a :: f). f a #-> App @f @f0 a + (Indeed, I sometimes struggle even printing this correctly, + due to its ill-scoped nature.) + • In the definition of data constructor ‘MkApp’ In the data declaration for ‘App’ diff --git a/testsuite/tests/typecheck/should_fail/T15862.stderr b/testsuite/tests/typecheck/should_fail/T15862.stderr index 97fbfab166..aeb0f73b9b 100644 --- a/testsuite/tests/typecheck/should_fail/T15862.stderr +++ b/testsuite/tests/typecheck/should_fail/T15862.stderr @@ -1,28 +1,7 @@ -T15862.hs:17:7: error: - • No instance for (Typeable 'MkFoo) arising from a use of ‘typeRep’ - GHC can't yet do polykinded - Typeable ('MkFoo :: (forall a. a) -> Foo) - • In the expression: typeRep @MkFoo - In an equation for ‘foo’: foo = typeRep @MkFoo - -T15862.hs:25:7: error: - • No instance for (Typeable 'MkBar) arising from a use of ‘typeRep’ - GHC can't yet do polykinded Typeable ('MkBar :: Bool -> Bar) - • In the expression: typeRep - In an equation for ‘bar’: bar = typeRep - -T15862.hs:30:8: error: - • No instance for (Typeable 'MkQuux) - arising from a use of ‘typeRep’ - GHC can't yet do polykinded - Typeable ('MkQuux :: (# Bool | Int #) -> Quux) - • In the expression: typeRep - In an equation for ‘quux’: quux = typeRep - -T15862.hs:36:8: error: - • No instance for (Typeable 'MkQuuz) - arising from a use of ‘typeRep’ - GHC can't yet do polykinded Typeable ('MkQuuz :: Quuz) - • In the expression: typeRep - In an equation for ‘quuz’: quuz = typeRep +T15862.hs:16:16: error: + • Expected kind ‘k0’, but ‘MkFoo’ has kind ‘(forall a. a) -> Foo’ + Cannot instantiate unification variable ‘k0’ + with a kind involving polytypes: (forall a. a) -> Foo + • In the first argument of ‘TypeRep’, namely ‘MkFoo’ + In the type signature: foo :: TypeRep MkFoo diff --git a/testsuite/tests/typecheck/should_fail/T15962.stderr b/testsuite/tests/typecheck/should_fail/T15962.stderr index ffab68c98e..49dbb8ce96 100644 --- a/testsuite/tests/typecheck/should_fail/T15962.stderr +++ b/testsuite/tests/typecheck/should_fail/T15962.stderr @@ -1,18 +1,18 @@ -T15962.hs:27:11: - Found hole: _ :: Big ks -> Big (Eval (Map Dual ks)) + +T15962.hs:27:11: error: + • Found hole: _ :: Big ks -> Big (Eval (Map Dual ks)) Where: ‘ks’ is a rigid type variable bound by the type signature for: dualBig :: forall (ks :: [OpKind]). Big ks -> Big (Eval (Map Dual ks)) at T15962.hs:26:1-45 - In the expression: _ - In an equation for ‘dualBig’: dualBig = _ - Relevant bindings include + • In an equation for ‘dualBig’: dualBig = _ + • Relevant bindings include dualBig :: Big ks -> Big (Eval (Map Dual ks)) (bound at T15962.hs:27:1) Valid hole fits include dualBig :: Big ks -> Big (Eval (Map Dual ks)) (bound at T15962.hs:27:1) -T15962.hs:33:12: +T15962.hs:33:12: error: Variable not in scope: iDontExist :: Big ('Conjunction : ks) diff --git a/testsuite/tests/typecheck/should_fail/T16456.stderr b/testsuite/tests/typecheck/should_fail/T16456.stderr index fbc0cc6ed5..5e69b9352a 100644 --- a/testsuite/tests/typecheck/should_fail/T16456.stderr +++ b/testsuite/tests/typecheck/should_fail/T16456.stderr @@ -1,8 +1,7 @@ T16456.hs:7:7: error: • Found hole: _ :: T Int - • In the expression: _ - In an equation for ‘foo’: foo = _ + • In an equation for ‘foo’: foo = _ • Relevant bindings include foo :: T Int (bound at T16456.hs:7:1) Valid hole fits include foo :: T Int (bound at T16456.hs:7:1) diff --git a/testsuite/tests/typecheck/should_fail/T17773.stderr b/testsuite/tests/typecheck/should_fail/T17773.stderr index 401fcc494a..22b3d5577e 100644 --- a/testsuite/tests/typecheck/should_fail/T17773.stderr +++ b/testsuite/tests/typecheck/should_fail/T17773.stderr @@ -8,8 +8,7 @@ T17773.hs:16:22: error: Proxy x -> Proxy y -> Mzero x y :~: (x <|> y) at T17773.hs:(13,1)-(15,41) Or perhaps ‘_Refl’ is mis-spelled, or not in scope - • In the expression: _Refl - In an equation for ‘monadPlusMplus’: monadPlusMplus _ _ = _Refl + • In an equation for ‘monadPlusMplus’: monadPlusMplus _ _ = _Refl • Relevant bindings include monadPlusMplus :: Proxy x -> Proxy y -> Mzero x y :~: (x <|> y) (bound at T17773.hs:16:1) diff --git a/testsuite/tests/typecheck/should_fail/T18640a.hs b/testsuite/tests/typecheck/should_fail/T18640a.hs new file mode 100644 index 0000000000..b208cfadaa --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T18640a.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE StandaloneKindSignatures #-} + +module T18640a where + +import Data.Kind + +type F2 :: forall a b. Type -> a +type family F2 :: forall b. Type -> Type where diff --git a/testsuite/tests/typecheck/should_fail/T18640a.stderr b/testsuite/tests/typecheck/should_fail/T18640a.stderr new file mode 100644 index 0000000000..edc9a83c25 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T18640a.stderr @@ -0,0 +1,9 @@ + +T18640a.hs:11:1: error: + • Couldn't match kind ‘a’ with ‘*’ + Expected: forall (b :: k). * -> * + Actual: forall (b :: k). * -> a + ‘a’ is a rigid type variable bound by + the type family declaration for ‘F2’ + at T18640a.hs:10:19 + • In the type family declaration for ‘F2’ diff --git a/testsuite/tests/typecheck/should_fail/T18640b.hs b/testsuite/tests/typecheck/should_fail/T18640b.hs new file mode 100644 index 0000000000..f722805ca9 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T18640b.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE StandaloneKindSignatures #-} + +module T18640b where + +import Data.Kind + +data family F1 (k :: Type) :: k + +type F3 :: forall (a :: Type) -> forall (b :: Type) -> a +type family F3 a where + F3 a = F1 diff --git a/testsuite/tests/typecheck/should_fail/T18640b.stderr b/testsuite/tests/typecheck/should_fail/T18640b.stderr new file mode 100644 index 0000000000..2a84295a73 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T18640b.stderr @@ -0,0 +1,12 @@ + +T18640b.hs:14:10: error: + • Couldn't match kind ‘k’ with ‘a’ + Expected kind ‘forall b -> a’, but ‘F1’ has kind ‘forall k -> k’ + ‘k’ is a rigid type variable bound by + the type k + at T18640b.hs:14:3-11 + ‘a’ is a rigid type variable bound by + a family instance declaration + at T18640b.hs:14:6 + • In the type ‘F1’ + In the type family declaration for ‘F3’ diff --git a/testsuite/tests/typecheck/should_fail/T18640c.hs b/testsuite/tests/typecheck/should_fail/T18640c.hs new file mode 100644 index 0000000000..eb6479cc3b --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T18640c.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE StandaloneKindSignatures #-} + +module T18640c where + +import Data.Kind + +type F1 :: forall k -> Type +type family F1 k :: Type + +type F2 :: forall x. forall k -> x +type F2 = F1 diff --git a/testsuite/tests/typecheck/should_fail/T18640c.stderr b/testsuite/tests/typecheck/should_fail/T18640c.stderr new file mode 100644 index 0000000000..447882717f --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T18640c.stderr @@ -0,0 +1,10 @@ + +T18640c.hs:14:11: error: + • Couldn't match kind ‘x’ with ‘*’ + Expected kind ‘forall (k1 :: k) -> x’, + but ‘F1’ has kind ‘forall (k1 :: k) -> *’ + ‘x’ is a rigid type variable bound by + the type synonym declaration for ‘F2’ + at T18640c.hs:13:19 + • In the type ‘F1’ + In the type declaration for ‘F2’ diff --git a/testsuite/tests/typecheck/should_fail/T1899.stderr b/testsuite/tests/typecheck/should_fail/T1899.stderr index eb84cba7b4..bd4aceed9e 100644 --- a/testsuite/tests/typecheck/should_fail/T1899.stderr +++ b/testsuite/tests/typecheck/should_fail/T1899.stderr @@ -1,5 +1,5 @@ -T1899.hs:14:36: error: +T1899.hs:15:36: error: • Couldn't match type ‘a’ with ‘Proposition a0’ Expected: [Proposition a0] Actual: [a] diff --git a/testsuite/tests/typecheck/should_fail/T2846b.hs b/testsuite/tests/typecheck/should_fail/T2846b.hs index 87468df87e..07f24e7627 100644 --- a/testsuite/tests/typecheck/should_fail/T2846b.hs +++ b/testsuite/tests/typecheck/should_fail/T2846b.hs @@ -3,4 +3,6 @@ module T2846 where f :: String f = show ([1,2,3] :: [Num a => a]) - +-- Rejected with Quick Look +-- The arg of 'show' is a naked 'a' +-- And the actual arg has type (forall a. [Num a => a]), which is polymorphic diff --git a/testsuite/tests/typecheck/should_fail/T2846b.stderr b/testsuite/tests/typecheck/should_fail/T2846b.stderr index 8c52fd7d33..95b30407f2 100644 --- a/testsuite/tests/typecheck/should_fail/T2846b.stderr +++ b/testsuite/tests/typecheck/should_fail/T2846b.stderr @@ -1,7 +1,10 @@ -T2846b.hs:5:5: error: - • No instance for (Show (Num a0 => a0)) - arising from a use of ‘show’ - (maybe you haven't applied a function to enough arguments?) - • In the expression: show ([1, 2, 3] :: [Num a => a]) +T2846b.hs:5:11: error: + • Couldn't match expected type ‘a1’ + with actual type ‘[Num a0 => a0]’ + Cannot instantiate unification variable ‘a1’ + with a type involving polytypes: [Num a0 => a0] + • In the first argument of ‘show’, namely + ‘([1, 2, 3] :: [Num a => a])’ + In the expression: show ([1, 2, 3] :: [Num a => a]) In an equation for ‘f’: f = show ([1, 2, 3] :: [Num a => a]) diff --git a/testsuite/tests/typecheck/should_fail/T5570.stderr b/testsuite/tests/typecheck/should_fail/T5570.stderr index 710104012d..0c12be680e 100644 --- a/testsuite/tests/typecheck/should_fail/T5570.stderr +++ b/testsuite/tests/typecheck/should_fail/T5570.stderr @@ -1,6 +1,6 @@ T5570.hs:7:16: error: • Expecting a lifted type, but ‘Double#’ is unlifted - • In the second argument of ‘($)’, namely ‘D# $ 3.0##’ + • In the first argument of ‘($)’, namely ‘D#’ + In the second argument of ‘($)’, namely ‘D# $ 3.0##’ In the expression: print $ D# $ 3.0## - In an equation for ‘main’: main = print $ D# $ 3.0## diff --git a/testsuite/tests/typecheck/should_fail/T6069.stderr b/testsuite/tests/typecheck/should_fail/T6069.stderr index c70939fee5..ffad9a9534 100644 --- a/testsuite/tests/typecheck/should_fail/T6069.stderr +++ b/testsuite/tests/typecheck/should_fail/T6069.stderr @@ -5,8 +5,8 @@ T6069.hs:13:15: error: Expected: ST s0 Int -> b0 Actual: (forall s. ST s b0) -> b0 • In the second argument of ‘(.)’, namely ‘runST’ - In the expression: print . runST In the expression: (print . runST) fourty_two + In an equation for ‘f1’: f1 = (print . runST) fourty_two T6069.hs:14:15: error: • Couldn't match type: forall s. ST s b1 diff --git a/testsuite/tests/typecheck/should_fail/T7734.stderr b/testsuite/tests/typecheck/should_fail/T7734.stderr index bf199cb4c2..f47fd3b393 100644 --- a/testsuite/tests/typecheck/should_fail/T7734.stderr +++ b/testsuite/tests/typecheck/should_fail/T7734.stderr @@ -1,6 +1,9 @@ T7734.hs:4:13: error: • Couldn't match expected type ‘t’ with actual type ‘t -> t1’ + ‘t’ is a rigid type variable bound by + the inferred type of f :: (t -> t1) -> p -> t1 + at T7734.hs:4:1-13 • In the first argument of ‘x’, namely ‘x’ In the expression: x x In an equation for ‘f’: x `f` y = x x @@ -10,6 +13,9 @@ T7734.hs:4:13: error: T7734.hs:5:13: error: • Couldn't match expected type ‘t’ with actual type ‘t -> t1’ + ‘t’ is a rigid type variable bound by + the inferred type of & :: (t -> t1) -> p -> t1 + at T7734.hs:5:1-13 • In the first argument of ‘x’, namely ‘x’ In the expression: x x In an equation for ‘&’: (&) x y = x x diff --git a/testsuite/tests/typecheck/should_fail/T8450.stderr b/testsuite/tests/typecheck/should_fail/T8450.stderr index a75d0703c6..9ac0d63643 100644 --- a/testsuite/tests/typecheck/should_fail/T8450.stderr +++ b/testsuite/tests/typecheck/should_fail/T8450.stderr @@ -1,5 +1,5 @@ -T8450.hs:8:20: error: +T8450.hs:8:19: error: • Couldn't match type ‘a’ with ‘Bool’ Expected: Either Bool () Actual: Either a () diff --git a/testsuite/tests/typecheck/should_fail/T8570.stderr b/testsuite/tests/typecheck/should_fail/T8570.stderr index d79ea6581f..183001b577 100644 --- a/testsuite/tests/typecheck/should_fail/T8570.stderr +++ b/testsuite/tests/typecheck/should_fail/T8570.stderr @@ -1,10 +1,4 @@ -T8570.hs:6:11: error: - • Couldn't match expected type ‘Image’ with actual type ‘Field’ - • In the pattern: Image {filepath = x} - In a pattern binding: Image {filepath = x} = logo - In the expression: let Image {filepath = x} = logo in x - T8570.hs:6:18: error: • Constructor ‘Image’ does not have field ‘filepath’ • In the pattern: Image {filepath = x} diff --git a/testsuite/tests/typecheck/should_fail/T8603.stderr b/testsuite/tests/typecheck/should_fail/T8603.stderr index 4776253f52..e202ca2610 100644 --- a/testsuite/tests/typecheck/should_fail/T8603.stderr +++ b/testsuite/tests/typecheck/should_fail/T8603.stderr @@ -1,15 +1,29 @@ T8603.hs:33:17: error: - • Couldn't match type: RV a1 - with: StateT s RV a0 + • Couldn't match kind ‘*’ with ‘* -> *’ + When matching types + (->) [a1] :: * -> * + [a2] :: * Expected: [a2] -> StateT s RV a0 - Actual: t0 ((->) [a1]) (RV a1) + Actual: t0 ((->) [a1]) (StateT s RV a0) • The function ‘lift’ is applied to two value arguments, - but its type ‘([a1] -> RV a1) -> t0 ((->) [a1]) (RV a1)’ + but its type ‘([a1] -> StateT s RV a0) + -> t0 ((->) [a1]) (StateT s RV a0)’ has only one In a stmt of a 'do' block: prize <- lift uniform [1, 2, 3] In the expression: do prize <- lift uniform [1, 2, ....] return False + +T8603.hs:33:22: error: + • Couldn't match type: RV a1 + with: StateT s RV a0 + Expected: [a1] -> StateT s RV a0 + Actual: [a1] -> RV a1 + • In the first argument of ‘lift’, namely ‘uniform’ + In a stmt of a 'do' block: prize <- lift uniform [1, 2, 3] + In the expression: + do prize <- lift uniform [1, 2, ....] + return False • Relevant bindings include testRVState1 :: RVState s Bool (bound at T8603.hs:32:1) diff --git a/testsuite/tests/typecheck/should_fail/T9109.stderr b/testsuite/tests/typecheck/should_fail/T9109.stderr index f30c49bde6..6a4d4988de 100644 --- a/testsuite/tests/typecheck/should_fail/T9109.stderr +++ b/testsuite/tests/typecheck/should_fail/T9109.stderr @@ -1,13 +1,13 @@ T9109.hs:8:13: error: - • Couldn't match expected type ‘p’ with actual type ‘Bool’ - ‘p’ is untouchable - inside the constraints: a ~ Bool - bound by a pattern with constructor: GBool :: G Bool, - in an equation for ‘foo’ - at T9109.hs:8:5-9 + • Could not deduce: p ~ Bool + from the context: a ~ Bool + bound by a pattern with constructor: GBool :: G Bool, + in an equation for ‘foo’ + at T9109.hs:8:5-9 ‘p’ is a rigid type variable bound by - the inferred type of foo :: G a -> p at T9109.hs:8:1-16 + the inferred type of foo :: G a -> p + at T9109.hs:8:1-16 Possible fix: add a type signature for ‘foo’ • In the expression: True In an equation for ‘foo’: foo GBool = True diff --git a/testsuite/tests/typecheck/should_fail/T9497d.stderr b/testsuite/tests/typecheck/should_fail/T9497d.stderr index fff9e2e6a8..42da4bf430 100644 --- a/testsuite/tests/typecheck/should_fail/T9497d.stderr +++ b/testsuite/tests/typecheck/should_fail/T9497d.stderr @@ -2,8 +2,7 @@ T9497d.hs:2:8: error: • Found hole: _main :: IO () Or perhaps ‘_main’ is mis-spelled, or not in scope - • In the expression: _main - In an equation for ‘main’: main = _main + • In an equation for ‘main’: main = _main • Relevant bindings include main :: IO () (bound at T9497d.hs:2:1) Valid hole fits include main :: IO () (bound at T9497d.hs:2:1) diff --git a/testsuite/tests/typecheck/should_fail/T9858e.stderr b/testsuite/tests/typecheck/should_fail/T9858e.stderr index f397723a02..0ea9d4736a 100644 --- a/testsuite/tests/typecheck/should_fail/T9858e.stderr +++ b/testsuite/tests/typecheck/should_fail/T9858e.stderr @@ -1,5 +1,5 @@ -T9858e.hs:9:8: error: +T9858e.hs:9:7: error: • Couldn't match type: Eq Int => Int with: a0 b0 Expected: Proxy (a0 b0) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 6b10777f12..bc325be674 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -580,3 +580,7 @@ test('T18357b', normal, compile_fail, ['']) test('T18455', normal, compile_fail, ['']) test('T18534', normal, compile_fail, ['']) test('T18714', normal, compile_fail, ['']) +test('too-many', normal, compile_fail, ['']) +test('T18640a', normal, compile_fail, ['']) +test('T18640b', normal, compile_fail, ['']) +test('T18640c', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_fail/tcfail002.stderr b/testsuite/tests/typecheck/should_fail/tcfail002.stderr index 7de2d04c08..4e14032d62 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail002.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail002.stderr @@ -1,6 +1,9 @@ tcfail002.hs:4:7: error: • Couldn't match expected type ‘a’ with actual type ‘[a]’ + ‘a’ is a rigid type variable bound by + the inferred type of c :: [a] -> a + at tcfail002.hs:(3,1)-(4,7) • In the expression: z In an equation for ‘c’: c z = z • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_fail/tcfail014.stderr b/testsuite/tests/typecheck/should_fail/tcfail014.stderr index 65b217ef1f..5525e01510 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail014.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail014.stderr @@ -1,6 +1,9 @@ tcfail014.hs:5:33: error: • Couldn't match expected type ‘t4’ with actual type ‘t4 -> t5’ + ‘t4’ is a rigid type variable bound by + the inferred type of h :: (t4 -> t5) -> t5 + at tcfail014.hs:5:25-33 • In the first argument of ‘z’, namely ‘z’ In the expression: z z In an equation for ‘h’: h z = z z diff --git a/testsuite/tests/typecheck/should_fail/tcfail032.stderr b/testsuite/tests/typecheck/should_fail/tcfail032.stderr index a09941d284..bb7eafc6fb 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail032.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail032.stderr @@ -1,11 +1,9 @@ tcfail032.hs:14:8: error: • Couldn't match expected type ‘a1 -> Int’ with actual type ‘p’ - because type variable ‘a1’ would escape its scope - This (rigid, skolem) type variable is bound by - an expression type signature: - forall a1. Eq a1 => a1 -> Int - at tcfail032.hs:14:13-30 + ‘p’ is a rigid type variable bound by + the inferred type of f :: Eq a => p -> a -> Int + at tcfail032.hs:14:1-31 • In the expression: x :: (Eq a) => a -> Int In an equation for ‘f’: f x = (x :: (Eq a) => a -> Int) • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_fail/tcfail033.stderr b/testsuite/tests/typecheck/should_fail/tcfail033.stderr index a1c5e7d7d0..2b2089d8ec 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail033.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail033.stderr @@ -1,6 +1,9 @@ tcfail033.hs:4:12: error: • Couldn't match expected type ‘(a, b)’ with actual type ‘a’ + ‘a’ is a rigid type variable bound by + the inferred type of buglet :: [(a, b)] + at tcfail033.hs:4:1-32 • In the expression: x In the expression: [x | (x, y) <- buglet] In an equation for ‘buglet’: buglet = [x | (x, y) <- buglet] diff --git a/testsuite/tests/typecheck/should_fail/tcfail140.stderr b/testsuite/tests/typecheck/should_fail/tcfail140.stderr index 8de86280e1..4e1ced2fc9 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail140.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail140.stderr @@ -9,7 +9,7 @@ tcfail140.hs:10:7: error: tcfail140.hs:12:10: error: • Couldn't match expected type ‘t1 -> t’ with actual type ‘Int’ - • The operator ‘f’ takes two value arguments, + • The function ‘f’ is applied to two value arguments, but its type ‘Int -> Int’ has only one In the expression: 3 `f` 4 In an equation for ‘rot’: rot xs = 3 `f` 4 @@ -19,7 +19,7 @@ tcfail140.hs:12:10: error: tcfail140.hs:14:15: error: • Couldn't match expected type ‘a -> b’ with actual type ‘Int’ • The operator ‘f’ takes two value arguments, - but its type ‘Int -> Int’ has only one + but its type ‘Int -> Int’ has only one In the first argument of ‘map’, namely ‘(3 `f`)’ In the expression: map (3 `f`) xs • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_fail/tcfail165.stderr b/testsuite/tests/typecheck/should_fail/tcfail165.stderr index b1f173f447..ecbec54fb5 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail165.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail165.stderr @@ -1,12 +1,17 @@ -tcfail165.hs:19:23: error: - • Couldn't match expected type: forall a. Show a => a -> String - with actual type: b0 -> String - • In the second argument of ‘putMVar’, namely - ‘(show :: forall b. Show b => b -> String)’ - In a stmt of a 'do' block: - putMVar var (show :: forall b. Show b => b -> String) +tcfail165.hs:18:17: error: + • Couldn't match type: forall a. Show a => a -> String + with: b0 -> String + Expected: IO (MVar (b0 -> String)) + Actual: IO (MVar (forall a. Show a => a -> String)) + • In a stmt of a 'do' block: + var <- newEmptyMVar :: IO (MVar (forall a. Show a => a -> String)) In the expression: do var <- newEmptyMVar :: IO (MVar (forall a. Show a => a -> String)) putMVar var (show :: forall b. Show b => b -> String) + In an equation for ‘foo’: + foo + = do var <- newEmptyMVar :: + IO (MVar (forall a. Show a => a -> String)) + putMVar var (show :: forall b. Show b => b -> String) diff --git a/testsuite/tests/typecheck/should_fail/tcfail174.hs b/testsuite/tests/typecheck/should_fail/tcfail174.hs index c3328ea4e7..226a9ee36e 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail174.hs +++ b/testsuite/tests/typecheck/should_fail/tcfail174.hs @@ -6,12 +6,16 @@ data Capture a = Base a | Capture (Capture (forall x . x -> a)) g :: Capture (forall a . a -> a) -g = Base id -- Fails; need a rigid signature on 'id' +g = Base id + -- Fails; need a rigid signature on 'id' -- Actually, succeeds now, with visible type application -- Disagree: should not succeed because it instantiates -- Base with a forall type + -- May 20: succeeds with Quick Look --- This function should definitely be rejected, with or without type signature + +-- h should definitely be rejected, +-- with (h2) or without (h1) type signature h1 = Capture g diff --git a/testsuite/tests/typecheck/should_fail/tcfail174.stderr b/testsuite/tests/typecheck/should_fail/tcfail174.stderr index 5747a270ef..8ac8d3f9d5 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail174.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail174.stderr @@ -1,29 +1,21 @@ -tcfail174.hs:9:5: error: - • Couldn't match type: a0 -> a0 - with: forall a. a -> a - Expected: Capture (forall a. a -> a) - Actual: Capture (a0 -> a0) - • In the expression: Base id - In an equation for ‘g’: g = Base id - -tcfail174.hs:16:14: error: +tcfail174.hs:20:14: error: • Couldn't match type ‘a1’ with ‘a’ Expected: Capture (forall x. x -> a) Actual: Capture (forall a. a -> a) ‘a1’ is a rigid type variable bound by the type a -> a - at tcfail174.hs:16:1-14 + at tcfail174.hs:20:1-14 ‘a’ is a rigid type variable bound by the inferred type of h1 :: Capture a - at tcfail174.hs:16:1-14 + at tcfail174.hs:20:1-14 • In the first argument of ‘Capture’, namely ‘g’ In the expression: Capture g In an equation for ‘h1’: h1 = Capture g • Relevant bindings include - h1 :: Capture a (bound at tcfail174.hs:16:1) + h1 :: Capture a (bound at tcfail174.hs:20:1) -tcfail174.hs:19:14: error: +tcfail174.hs:23:14: error: • Couldn't match type ‘a’ with ‘b’ Expected: Capture (forall x. x -> b) Actual: Capture (forall a. a -> a) @@ -33,9 +25,9 @@ tcfail174.hs:19:14: error: ‘b’ is a rigid type variable bound by the type signature for: h2 :: forall b. Capture b - at tcfail174.hs:18:1-15 + at tcfail174.hs:22:1-15 • In the first argument of ‘Capture’, namely ‘g’ In the expression: Capture g In an equation for ‘h2’: h2 = Capture g • Relevant bindings include - h2 :: Capture b (bound at tcfail174.hs:19:1) + h2 :: Capture b (bound at tcfail174.hs:23:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail204.stderr b/testsuite/tests/typecheck/should_fail/tcfail204.stderr index 8083ffce60..a1ab99c445 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail204.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail204.stderr @@ -2,7 +2,7 @@ tcfail204.hs:10:7: error: [-Wtype-defaults (in -Wall), -Werror=type-defaults] • Defaulting the following constraints to type ‘Double’ (RealFrac a0) - arising from a use of ‘ceiling’ at tcfail204.hs:10:7-17 + arising from a use of ‘ceiling’ at tcfail204.hs:10:7-13 (Fractional a0) arising from the literal ‘6.3’ at tcfail204.hs:10:15-17 • In the expression: ceiling 6.3 diff --git a/testsuite/tests/typecheck/should_fail/tcfail218.stderr b/testsuite/tests/typecheck/should_fail/tcfail218.stderr index efb6c4c9d3..f591b09b2a 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail218.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail218.stderr @@ -1,11 +1,11 @@ -tcfail218.hs:16:5: - Overlapping instances for C [a] Bool arising from a use of ‘foo’ - Matching instances: - instance C [a] b -- Defined at tcfail218.hs:8:29 - instance C [Int] Bool -- Defined at tcfail218.hs:7:29 - (The choice depends on the instantiation of ‘a’ - To pick the first instance above, use IncoherentInstances - when compiling the other instance declarations) - In the expression: foo - In an equation for ‘x’: x = foo +tcfail218.hs:16:5: error: + • Overlapping instances for C [a] Bool arising from a use of ‘foo’ + Matching instances: + instance C [a] b -- Defined at tcfail218.hs:8:29 + instance C [Int] Bool -- Defined at tcfail218.hs:7:29 + (The choice depends on the instantiation of ‘a’ + To pick the first instance above, use IncoherentInstances + when compiling the other instance declarations) + • In the expression: foo + In an equation for ‘x’: x = foo diff --git a/testsuite/tests/typecheck/should_fail/too-many.hs b/testsuite/tests/typecheck/should_fail/too-many.hs new file mode 100644 index 0000000000..e3a4e2ba04 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/too-many.hs @@ -0,0 +1,18 @@ +module TooMany where + +foo :: (Int -> Int -> Bool) -> Int +foo = error "urk" + +f1 :: Int -> Int -> Int -> Bool +f1 = f1 + +g1 = foo (f1 2 3) + -- Here is is sensible to report + -- f1 is applied to too many arguments + +f2 :: Int -> Bool +f2 = f2 + +g2 = foo (f2 2) + -- Here is is /not/ sensible to report + -- f2 is applied to too many arguments diff --git a/testsuite/tests/typecheck/should_fail/too-many.stderr b/testsuite/tests/typecheck/should_fail/too-many.stderr new file mode 100644 index 0000000000..01e50050ff --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/too-many.stderr @@ -0,0 +1,16 @@ + +too-many.hs:9:11: error: + • Couldn't match type ‘Bool’ with ‘Int -> Bool’ + Expected: Int -> Int -> Bool + Actual: Int -> Bool + • Possible cause: ‘f1’ is applied to too many arguments + In the first argument of ‘foo’, namely ‘(f1 2 3)’ + In the expression: foo (f1 2 3) + In an equation for ‘g1’: g1 = foo (f1 2 3) + +too-many.hs:16:11: error: + • Couldn't match expected type ‘Int -> Int -> Bool’ + with actual type ‘Bool’ + • In the first argument of ‘foo’, namely ‘(f2 2)’ + In the expression: foo (f2 2) + In an equation for ‘g2’: g2 = foo (f2 2) |