From 7dc0dc9962e90ca8dcd01c547adab4f7c43d6090 Mon Sep 17 00:00:00 2001 From: CarrieMY Date: Sun, 25 Jul 2021 12:20:13 +0800 Subject: Fix type check error message grammar (fixes #20122) Remove trailing spaces --- testsuite/tests/typecheck/should_fail/T20122.hs | 11 ++++ .../tests/typecheck/should_fail/T20122.stderr | 12 ++++ testsuite/tests/typecheck/should_fail/T4921.stderr | 7 +- testsuite/tests/typecheck/should_fail/T5858.stderr | 5 +- testsuite/tests/typecheck/should_fail/all.T | 1 + .../tests/typecheck/should_fail/tcfail040.stderr | 16 ++--- .../tests/typecheck/should_fail/tcfail043.stderr | 76 +++++++++++----------- .../tests/typecheck/should_fail/tcfail128.stderr | 2 +- 8 files changed, 78 insertions(+), 52 deletions(-) create mode 100644 testsuite/tests/typecheck/should_fail/T20122.hs create mode 100644 testsuite/tests/typecheck/should_fail/T20122.stderr (limited to 'testsuite/tests/typecheck/should_fail') diff --git a/testsuite/tests/typecheck/should_fail/T20122.hs b/testsuite/tests/typecheck/should_fail/T20122.hs new file mode 100644 index 0000000000..c9e424dbc2 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T20122.hs @@ -0,0 +1,11 @@ +module T20122 where + +class Testable a where + test :: a -> Bool + +data A = A + +instance Testable A where + test _ = True + +foo = test diff --git a/testsuite/tests/typecheck/should_fail/T20122.stderr b/testsuite/tests/typecheck/should_fail/T20122.stderr new file mode 100644 index 0000000000..f3e987ee23 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T20122.stderr @@ -0,0 +1,12 @@ + +T20122.hs:11:7: error: + • Ambiguous type variable ‘a0’ arising from a use of ‘test’ + prevents the constraint ‘(Testable a0)’ from being solved. + Relevant bindings include + foo :: a0 -> Bool (bound at T20122.hs:11:1) + Probable fix: use a type annotation to specify what ‘a0’ should be. + This potential instance exists: + instance Testable A + -- Defined at T20122.hs:8:10 + • In the expression: test + In an equation for ‘foo’: foo = test diff --git a/testsuite/tests/typecheck/should_fail/T4921.stderr b/testsuite/tests/typecheck/should_fail/T4921.stderr index 8eff919aea..c4510cbb08 100644 --- a/testsuite/tests/typecheck/should_fail/T4921.stderr +++ b/testsuite/tests/typecheck/should_fail/T4921.stderr @@ -3,8 +3,9 @@ T4921.hs:10:9: error: • Ambiguous type variables ‘a0’, ‘b1’ arising from a use of ‘f’ prevents the constraint ‘(C a0 b1)’ from being solved. Relevant bindings include x :: a0 (bound at T4921.hs:10:1) - Probable fix: use a type annotation to specify what ‘a0’, ‘b1’ should be. - These potential instance exist: + Probable fix: use a type annotation to specify what ‘a0’, + ‘b1’ should be. + This potential instance exists: instance C Int Char -- Defined at T4921.hs:7:10 • In the first argument of ‘fst’, namely ‘f’ In the expression: fst f @@ -14,7 +15,7 @@ T4921.hs:12:9: error: • Ambiguous type variable ‘b0’ arising from a use of ‘f’ prevents the constraint ‘(C Int b0)’ from being solved. Probable fix: use a type annotation to specify what ‘b0’ should be. - These potential instance exist: + This potential instance exists: instance C Int Char -- Defined at T4921.hs:7:10 • In the first argument of ‘fst’, namely ‘f’ In the expression: fst f :: Int diff --git a/testsuite/tests/typecheck/should_fail/T5858.stderr b/testsuite/tests/typecheck/should_fail/T5858.stderr index 829c027135..d5474da8a4 100644 --- a/testsuite/tests/typecheck/should_fail/T5858.stderr +++ b/testsuite/tests/typecheck/should_fail/T5858.stderr @@ -3,8 +3,9 @@ T5858.hs:11:7: error: • Ambiguous type variables ‘a0’, ‘a1’ arising from a use of ‘infer’ prevents the constraint ‘(InferOverloaded ([a0], [a1]))’ from being solved. - Probable fix: use a type annotation to specify what ‘a0’, ‘a1’ should be. - These potential instance exist: + Probable fix: use a type annotation to specify what ‘a0’, + ‘a1’ should be. + This potential instance exists: instance (t1 ~ String) => InferOverloaded (t1, t1) -- Defined at T5858.hs:8:10 • In the expression: infer ([], []) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 8745ea9172..b573f9b7f6 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -633,3 +633,4 @@ test('T19615', normal, compile_fail, ['']) test('T17817', normal, compile_fail, ['']) test('T17817_elab', normal, compile_fail, ['-fprint-typechecker-elaboration']) test('T19978', normal, compile_fail, ['']) +test('T20122', normal, compile_fail, ['']) \ No newline at end of file diff --git a/testsuite/tests/typecheck/should_fail/tcfail040.stderr b/testsuite/tests/typecheck/should_fail/tcfail040.stderr index 6e0da922c5..46e0b86577 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail040.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail040.stderr @@ -1,10 +1,10 @@ tcfail040.hs:19:5: error: - Ambiguous type variable ‘a0’ arising from a use of ‘<<’ - prevents the constraint ‘(ORD a0)’ from being solved. - Probable fix: use a type annotation to specify what ‘a0’ should be. - These potential instance exist: - instance ORD (a -> b) -- Defined at tcfail040.hs:17:10 - In the first argument of ‘(===)’, namely ‘(<<)’ - In the expression: (<<) === (<<) - In an equation for ‘f’: f = (<<) === (<<) + • Ambiguous type variable ‘a0’ arising from a use of ‘<<’ + prevents the constraint ‘(ORD a0)’ from being solved. + Probable fix: use a type annotation to specify what ‘a0’ should be. + This potential instance exists: + instance ORD (a -> b) -- Defined at tcfail040.hs:17:10 + • In the first argument of ‘(===)’, namely ‘(<<)’ + In the expression: (<<) === (<<) + In an equation for ‘f’: f = (<<) === (<<) diff --git a/testsuite/tests/typecheck/should_fail/tcfail043.stderr b/testsuite/tests/typecheck/should_fail/tcfail043.stderr index c30b5bf854..03aef3db67 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail043.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail043.stderr @@ -1,42 +1,42 @@ tcfail043.hs:38:17: error: - Ambiguous type variable ‘a0’ arising from a use of ‘gt’ - prevents the constraint ‘(Ord_ a0)’ from being solved. - Relevant bindings include - bs :: [a0] (bound at tcfail043.hs:38:8) - a :: a0 (bound at tcfail043.hs:38:6) - search :: a0 -> [a0] -> Bool (bound at tcfail043.hs:37:1) - Probable fix: use a type annotation to specify what ‘a0’ should be. - These potential instance exist: - instance Ord_ Int -- Defined at tcfail043.hs:34:10 - In the expression: gt (hd bs) a - In the expression: - if gt (hd bs) a then - False - else - if eq a (hd bs) then True else search a (tl bs) - In the expression: - \ a bs - -> if gt (hd bs) a then - False - else - if eq a (hd bs) then True else search a (tl bs) + • Ambiguous type variable ‘a0’ arising from a use of ‘gt’ + prevents the constraint ‘(Ord_ a0)’ from being solved. + Relevant bindings include + bs :: [a0] (bound at tcfail043.hs:38:8) + a :: a0 (bound at tcfail043.hs:38:6) + search :: a0 -> [a0] -> Bool (bound at tcfail043.hs:37:1) + Probable fix: use a type annotation to specify what ‘a0’ should be. + This potential instance exists: + instance Ord_ Int -- Defined at tcfail043.hs:34:10 + • In the expression: gt (hd bs) a + In the expression: + if gt (hd bs) a then + False + else + if eq a (hd bs) then True else search a (tl bs) + In the expression: + \ a bs + -> if gt (hd bs) a then + False + else + if eq a (hd bs) then True else search a (tl bs) tcfail043.hs:40:25: error: - Ambiguous type variable ‘a0’ arising from a use of ‘eq’ - prevents the constraint ‘(Eq_ a0)’ from being solved. - Relevant bindings include - bs :: [a0] (bound at tcfail043.hs:38:8) - a :: a0 (bound at tcfail043.hs:38:6) - search :: a0 -> [a0] -> Bool (bound at tcfail043.hs:37:1) - Probable fix: use a type annotation to specify what ‘a0’ should be. - These potential instances exist: - instance Eq_ Int -- Defined at tcfail043.hs:20:10 - instance Eq_ a => Eq_ [a] -- Defined at tcfail043.hs:23:10 - In the expression: eq a (hd bs) - In the expression: if eq a (hd bs) then True else search a (tl bs) - In the expression: - if gt (hd bs) a then - False - else - if eq a (hd bs) then True else search a (tl bs) + • Ambiguous type variable ‘a0’ arising from a use of ‘eq’ + prevents the constraint ‘(Eq_ a0)’ from being solved. + Relevant bindings include + bs :: [a0] (bound at tcfail043.hs:38:8) + a :: a0 (bound at tcfail043.hs:38:6) + search :: a0 -> [a0] -> Bool (bound at tcfail043.hs:37:1) + Probable fix: use a type annotation to specify what ‘a0’ should be. + These potential instances exist: + instance Eq_ Int -- Defined at tcfail043.hs:20:10 + instance Eq_ a => Eq_ [a] -- Defined at tcfail043.hs:23:10 + • In the expression: eq a (hd bs) + In the expression: if eq a (hd bs) then True else search a (tl bs) + In the expression: + if gt (hd bs) a then + False + else + if eq a (hd bs) then True else search a (tl bs) diff --git a/testsuite/tests/typecheck/should_fail/tcfail128.stderr b/testsuite/tests/typecheck/should_fail/tcfail128.stderr index d78c46a191..a63f290418 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail128.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail128.stderr @@ -4,7 +4,7 @@ tcfail128.hs:18:16: error: prevents the constraint ‘(Data.Array.Base.MArray b0 FlatVector IO)’ from being solved. Probable fix: use a type annotation to specify what ‘b0’ should be. - These potential instance exist: + This potential instance exists: one instance involving out-of-scope types (use -fprint-potential-instances to see them all) • In a stmt of a 'do' block: v <- thaw tmp -- cgit v1.2.1