diff options
Diffstat (limited to 'testsuite/tests/typecheck/should_fail')
11 files changed, 60 insertions, 40 deletions
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/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/T3176.stderr b/testsuite/tests/typecheck/should_fail/T3176.stderr index 1f089da6fe..6c8a749098 100644 --- a/testsuite/tests/typecheck/should_fail/T3176.stderr +++ b/testsuite/tests/typecheck/should_fail/T3176.stderr @@ -2,6 +2,7 @@ T3176.hs:9:27: error: • Cannot use record selector ‘unES’ as a function due to escaped type variables Probable fix: use pattern-matching syntax instead - • In the first argument of ‘($)’, namely ‘unES’ - In the second argument of ‘($)’, namely ‘unES $ f t’ + • In the second argument of ‘($)’, namely ‘unES $ f t’ In the expression: show $ unES $ f t + In an equation for ‘smallPrintES’: + smallPrintES f t = show $ unES $ f t 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/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/all.T b/testsuite/tests/typecheck/should_fail/all.T index 0b4e6b70d7..f9a19a34cf 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -575,3 +575,4 @@ test('ExplicitSpecificity7', normal, compile_fail, ['']) test('ExplicitSpecificity8', normal, compile_fail, ['']) test('ExplicitSpecificity9', normal, compile_fail, ['']) test('ExplicitSpecificity10', normal, compile_fail, ['']) +test('too-many', normal, compile_fail, ['']) 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/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/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) |