diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2014-10-02 17:47:21 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2014-10-07 08:03:31 +0100 |
commit | 48089ccf4f1f239b3268b2cb52b8aa0f7356485b (patch) | |
tree | 3cb31487ed2d7f9369f7d13a188e4f0167840009 /testsuite | |
parent | 2b59c7ac3f23dd229ddff20d991528ac742dfd24 (diff) | |
download | haskell-48089ccf4f1f239b3268b2cb52b8aa0f7356485b.tar.gz |
Use correct precedence when printing contexts with class operators
Fixes Trac #9658
Diffstat (limited to 'testsuite')
18 files changed, 97 insertions, 90 deletions
diff --git a/testsuite/tests/gadt/T7558.stderr b/testsuite/tests/gadt/T7558.stderr index f65c74395b..054c41f5aa 100644 --- a/testsuite/tests/gadt/T7558.stderr +++ b/testsuite/tests/gadt/T7558.stderr @@ -5,7 +5,7 @@ T7558.hs:8:4: the type signature for f :: T a a -> Bool at T7558.hs:7:6 Inaccessible code in a pattern with constructor - MkT :: forall a b. a ~ Maybe b => a -> Maybe b -> T a b, + MkT :: forall a b. (a ~ Maybe b) => a -> Maybe b -> T a b, in an equation for ‘f’ Relevant bindings include f :: T a a -> Bool (bound at T7558.hs:8:1) diff --git a/testsuite/tests/ghci/scripts/Defer02.stderr b/testsuite/tests/ghci/scripts/Defer02.stderr index ba2354bb87..746fa4eea2 100644 --- a/testsuite/tests/ghci/scripts/Defer02.stderr +++ b/testsuite/tests/ghci/scripts/Defer02.stderr @@ -80,21 +80,21 @@ ../../typecheck/should_run/Defer01.hs:45:6: Warning: Couldn't match type ‘Int’ with ‘Bool’ Inaccessible code in - the type signature for k :: Int ~ Bool => Int -> Bool - In the ambiguity check for: Int ~ Bool => Int -> Bool + the type signature for k :: (Int ~ Bool) => Int -> Bool + In the ambiguity check for: (Int ~ Bool) => Int -> Bool To defer the ambiguity check to use sites, enable AllowAmbiguousTypes In the type signature for ‘k’: k :: (Int ~ Bool) => Int -> Bool ../../typecheck/should_run/Defer01.hs:45:6: Warning: Couldn't match expected type ‘Bool’ with actual type ‘Int’ - In the ambiguity check for: Int ~ Bool => Int -> Bool + In the ambiguity check for: (Int ~ Bool) => Int -> Bool To defer the ambiguity check to use sites, enable AllowAmbiguousTypes In the type signature for ‘k’: k :: (Int ~ Bool) => Int -> Bool ../../typecheck/should_run/Defer01.hs:45:6: Warning: Couldn't match type ‘Int’ with ‘Bool’ Inaccessible code in - the type signature for k :: Int ~ Bool => Int -> Bool + the type signature for k :: (Int ~ Bool) => Int -> Bool ../../typecheck/should_run/Defer01.hs:46:7: Warning: Couldn't match expected type ‘Bool’ with actual type ‘Int’ diff --git a/testsuite/tests/ghci/scripts/T9658.script b/testsuite/tests/ghci/scripts/T9658.script new file mode 100644 index 0000000000..0b1f67ef0c --- /dev/null +++ b/testsuite/tests/ghci/scripts/T9658.script @@ -0,0 +1,4 @@ +:set -XTypeOperators +:set -XMultiParamTypeClasses +class a :-: b where op :: a -> b +:t op diff --git a/testsuite/tests/ghci/scripts/T9658.stdout b/testsuite/tests/ghci/scripts/T9658.stdout new file mode 100644 index 0000000000..fdde69ce91 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T9658.stdout @@ -0,0 +1 @@ +op :: (a :-: b) => a -> b diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index f02a3c0447..4b20d0b3e3 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -178,3 +178,4 @@ test('T8959b', expect_broken(8959), ghci_script, ['T8959b.script']) test('T9181', normal, ghci_script, ['T9181.script']) test('T9086b', normal, ghci_script, ['T9086b.script']) test('T9140', combined_output, ghci_script, ['T9140.script']) +test('T9658', normal, ghci_script, ['T9658.script']) diff --git a/testsuite/tests/indexed-types/should_compile/Simple14.stderr b/testsuite/tests/indexed-types/should_compile/Simple14.stderr index e2275b41c9..3dbf213695 100644 --- a/testsuite/tests/indexed-types/should_compile/Simple14.stderr +++ b/testsuite/tests/indexed-types/should_compile/Simple14.stderr @@ -1,18 +1,18 @@ -
-Simple14.hs:17:19:
- Couldn't match type ‘z0’ with ‘m’
- ‘z0’ is untouchable
- inside the constraints (Maybe m ~ Maybe n)
- bound by a type expected by the context:
- Maybe m ~ Maybe n => EQ_ z0 z0
- at Simple14.hs:17:12-33
- ‘m’ is a rigid type variable bound by
- the type signature for foo :: EQ_ (Maybe m) (Maybe n)
- at Simple14.hs:16:15
- Expected type: EQ_ z0 z0
- Actual type: EQ_ m n
- Relevant bindings include
- foo :: EQ_ (Maybe m) (Maybe n) (bound at Simple14.hs:17:1)
- In the second argument of ‘eqE’, namely ‘(eqI :: EQ_ m n)’
- In the first argument of ‘ntI’, namely ‘(`eqE` (eqI :: EQ_ m n))’
- In the expression: ntI (`eqE` (eqI :: EQ_ m n))
+ +Simple14.hs:17:19: + Couldn't match type ‘z0’ with ‘m’ + ‘z0’ is untouchable + inside the constraints (Maybe m ~ Maybe n) + bound by a type expected by the context: + (Maybe m ~ Maybe n) => EQ_ z0 z0 + at Simple14.hs:17:12-33 + ‘m’ is a rigid type variable bound by + the type signature for foo :: EQ_ (Maybe m) (Maybe n) + at Simple14.hs:16:15 + Expected type: EQ_ z0 z0 + Actual type: EQ_ m n + Relevant bindings include + foo :: EQ_ (Maybe m) (Maybe n) (bound at Simple14.hs:17:1) + In the second argument of ‘eqE’, namely ‘(eqI :: EQ_ m n)’ + In the first argument of ‘ntI’, namely ‘(`eqE` (eqI :: EQ_ m n))’ + In the expression: ntI (`eqE` (eqI :: EQ_ m n)) diff --git a/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.stderr b/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.stderr index 8ce4d38b78..3e34058def 100644 --- a/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.stderr +++ b/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.stderr @@ -3,7 +3,7 @@ ExtraTcsUntch.hs:24:53: Could not deduce (C [t] [a]) arising from a use of ‘op’ from the context (F Int ~ [[t]]) bound by the inferred type of - f :: F Int ~ [[t]] => [t] -> ((), ((), ())) + f :: (F Int ~ [[t]]) => [t] -> ((), ((), ())) at ExtraTcsUntch.hs:(21,1)-(25,29) In the expression: op x [y] In the expression: (h [[undefined]], op x [y]) diff --git a/testsuite/tests/indexed-types/should_fail/SimpleFail15.stderr b/testsuite/tests/indexed-types/should_fail/SimpleFail15.stderr index c54ba1697d..133eccf642 100644 --- a/testsuite/tests/indexed-types/should_fail/SimpleFail15.stderr +++ b/testsuite/tests/indexed-types/should_fail/SimpleFail15.stderr @@ -1,6 +1,6 @@ SimpleFail15.hs:5:8: - Illegal polymorphic or qualified type: a ~ b => t + Illegal polymorphic or qualified type: (a ~ b) => t Perhaps you intended to use RankNTypes or Rank2Types In the type signature for ‘foo’: foo :: (a, b) -> (a ~ b => t) -> (a, b) diff --git a/testsuite/tests/indexed-types/should_fail/T2239.stderr b/testsuite/tests/indexed-types/should_fail/T2239.stderr index 4a223ae8cb..a5e52277a0 100644 --- a/testsuite/tests/indexed-types/should_fail/T2239.stderr +++ b/testsuite/tests/indexed-types/should_fail/T2239.stderr @@ -16,8 +16,8 @@ T2239.hs:47:13: T2239.hs:50:13: Couldn't match type ‘Bool -> Bool’ - with ‘forall b1. b1 ~ Bool => b1 -> b1’ - Expected type: (forall b1. b1 ~ Bool => b1 -> b1) -> b -> b + with ‘forall b1. (b1 ~ Bool) => b1 -> b1’ + Expected type: (forall b1. (b1 ~ Bool) => b1 -> b1) -> b -> b Actual type: (b -> b) -> b -> b In the expression: id :: diff --git a/testsuite/tests/indexed-types/should_fail/T4093a.stderr b/testsuite/tests/indexed-types/should_fail/T4093a.stderr index e8b7749871..90b8a592f6 100644 --- a/testsuite/tests/indexed-types/should_fail/T4093a.stderr +++ b/testsuite/tests/indexed-types/should_fail/T4093a.stderr @@ -2,10 +2,10 @@ T4093a.hs:8:8: Could not deduce (e ~ ()) from the context (Foo e ~ Maybe e) - bound by the type signature for hang :: Foo e ~ Maybe e => Foo e + bound by the type signature for hang :: (Foo e ~ Maybe e) => Foo e at T4093a.hs:7:9-34 ‘e’ is a rigid type variable bound by - the type signature for hang :: Foo e ~ Maybe e => Foo e + the type signature for hang :: (Foo e ~ Maybe e) => Foo e at T4093a.hs:7:9 Expected type: Foo e Actual type: Maybe () diff --git a/testsuite/tests/perf/compiler/T5837.stderr b/testsuite/tests/perf/compiler/T5837.stderr index 5cee13dd1d..56d8ec9cb6 100644 --- a/testsuite/tests/perf/compiler/T5837.stderr +++ b/testsuite/tests/perf/compiler/T5837.stderr @@ -157,5 +157,5 @@ T5837.hs:8:6: (TF (TF a))))))))))))))))))))))))))))))))))))))))))))))))) - In the ambiguity check for: forall a. a ~ TF (a, Int) => Int + In the ambiguity check for: forall a. (a ~ TF (a, Int)) => Int In the type signature for ‘t’: t :: (a ~ TF (a, Int)) => Int diff --git a/testsuite/tests/polykinds/T7230.stderr b/testsuite/tests/polykinds/T7230.stderr index 0c34249223..9ec952a7ba 100644 --- a/testsuite/tests/polykinds/T7230.stderr +++ b/testsuite/tests/polykinds/T7230.stderr @@ -3,7 +3,8 @@ T7230.hs:48:32: Could not deduce ((x :<<= x1) ~ 'True) from the context (Increasing xs ~ 'True) bound by the type signature for - crash :: Increasing xs ~ 'True => SList xs -> SBool (Increasing xs) + crash :: (Increasing xs ~ 'True) => + SList xs -> SBool (Increasing xs) at T7230.hs:47:10-68 or from (xs ~ (x : xs1)) bound by a pattern with constructor diff --git a/testsuite/tests/roles/should_compile/Roles3.stderr b/testsuite/tests/roles/should_compile/Roles3.stderr index 18c294c4c5..5814d4d50a 100644 --- a/testsuite/tests/roles/should_compile/Roles3.stderr +++ b/testsuite/tests/roles/should_compile/Roles3.stderr @@ -14,7 +14,7 @@ TYPE CONSTRUCTORS type Syn2 a = [a] COERCION AXIOMS axiom Roles3.NTCo:C1 :: C1 a = a -> a - axiom Roles3.NTCo:C2 :: C2 a b = a ~ b => a -> b + axiom Roles3.NTCo:C2 :: C2 a b = (a ~ b) => a -> b axiom Roles3.NTCo:C3 :: C3 a b = a -> F3 b -> F3 b axiom Roles3.NTCo:C4 :: C4 a b = a -> F4 b -> F4 b Dependent modules: [] diff --git a/testsuite/tests/typecheck/should_fail/ContextStack2.stderr b/testsuite/tests/typecheck/should_fail/ContextStack2.stderr index e99e4c4264..746cf15d0c 100644 --- a/testsuite/tests/typecheck/should_fail/ContextStack2.stderr +++ b/testsuite/tests/typecheck/should_fail/ContextStack2.stderr @@ -5,5 +5,5 @@ ContextStack2.hs:8:6: (TF (TF (TF (TF (TF (TF (TF (TF (TF (TF (TF a)))))))))), TF (TF (TF (TF (TF (TF (TF (TF (TF (TF (TF Int))))))))))) ~ TF (TF (TF (TF (TF (TF (TF (TF (TF (TF a))))))))) - In the ambiguity check for: forall a. a ~ TF (a, Int) => Int + In the ambiguity check for: forall a. (a ~ TF (a, Int)) => Int In the type signature for ‘t’: t :: (a ~ TF (a, Int)) => Int diff --git a/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr b/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr index 848920c181..80ab8d83f6 100644 --- a/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr +++ b/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr @@ -1,53 +1,53 @@ -
-FrozenErrorTests.hs:12:12:
- Couldn't match type ‘Int’ with ‘Bool’
- Inaccessible code in
- a pattern with constructor
- MkT3 :: forall a. a ~ Bool => T a,
- in a case alternative
- In the pattern: MkT3
- In a case alternative: MkT3 -> ()
- In the expression: case x of { MkT3 -> () }
-
-FrozenErrorTests.hs:26:9:
- Occurs check: cannot construct the infinite type: a ~ [a]
- Expected type: [a]
- Actual type: F a Bool
- Relevant bindings include
- test1 :: a (bound at FrozenErrorTests.hs:26:1)
- In the expression: goo1 False undefined
- In an equation for ‘test1’: test1 = goo1 False undefined
-
-FrozenErrorTests.hs:29:15:
- Couldn't match type ‘Int’ with ‘[Int]’
- Expected type: [[Int]]
- Actual type: F [Int] Bool
- In the first argument of ‘goo2’, namely ‘(goo1 False undefined)’
- In the expression: goo2 (goo1 False undefined)
- In an equation for ‘test2’: test2 = goo2 (goo1 False undefined)
-
-FrozenErrorTests.hs:30:9:
- Couldn't match type ‘[Int]’ with ‘Int’
- Expected type: [[Int]]
- Actual type: F [Int] Bool
- In the expression: goo1 False (goo2 undefined)
- In an equation for ‘test3’: test3 = goo1 False (goo2 undefined)
-
-FrozenErrorTests.hs:45:15:
- Couldn't match type ‘T2 c c’ with ‘M (T2 (T2 c c) c)’
- Expected type: T2 (M (T2 (T2 c c) c)) (T2 (T2 c c) c)
- Actual type: F (T2 (T2 c c) c) Bool
- Relevant bindings include
- test4 :: T2 (T2 c c) c (bound at FrozenErrorTests.hs:45:1)
- In the first argument of ‘goo4’, namely ‘(goo3 False undefined)’
- In the expression: goo4 (goo3 False undefined)
- In an equation for ‘test4’: test4 = goo4 (goo3 False undefined)
-
-FrozenErrorTests.hs:46:9:
- Couldn't match type ‘T2 c c’ with ‘M (T2 (T2 c c) c)’
- Expected type: T2 (M (T2 (T2 c c) c)) (T2 (T2 c c) c)
- Actual type: F (T2 (T2 c c) c) Bool
- Relevant bindings include
- test5 :: T2 (T2 c c) c (bound at FrozenErrorTests.hs:46:1)
- In the expression: goo3 False (goo4 undefined)
- In an equation for ‘test5’: test5 = goo3 False (goo4 undefined)
+ +FrozenErrorTests.hs:12:12: + Couldn't match type ‘Int’ with ‘Bool’ + Inaccessible code in + a pattern with constructor + MkT3 :: forall a. (a ~ Bool) => T a, + in a case alternative + In the pattern: MkT3 + In a case alternative: MkT3 -> () + In the expression: case x of { MkT3 -> () } + +FrozenErrorTests.hs:26:9: + Occurs check: cannot construct the infinite type: a ~ [a] + Expected type: [a] + Actual type: F a Bool + Relevant bindings include + test1 :: a (bound at FrozenErrorTests.hs:26:1) + In the expression: goo1 False undefined + In an equation for ‘test1’: test1 = goo1 False undefined + +FrozenErrorTests.hs:29:15: + Couldn't match type ‘Int’ with ‘[Int]’ + Expected type: [[Int]] + Actual type: F [Int] Bool + In the first argument of ‘goo2’, namely ‘(goo1 False undefined)’ + In the expression: goo2 (goo1 False undefined) + In an equation for ‘test2’: test2 = goo2 (goo1 False undefined) + +FrozenErrorTests.hs:30:9: + Couldn't match type ‘[Int]’ with ‘Int’ + Expected type: [[Int]] + Actual type: F [Int] Bool + In the expression: goo1 False (goo2 undefined) + In an equation for ‘test3’: test3 = goo1 False (goo2 undefined) + +FrozenErrorTests.hs:45:15: + Couldn't match type ‘T2 c c’ with ‘M (T2 (T2 c c) c)’ + Expected type: T2 (M (T2 (T2 c c) c)) (T2 (T2 c c) c) + Actual type: F (T2 (T2 c c) c) Bool + Relevant bindings include + test4 :: T2 (T2 c c) c (bound at FrozenErrorTests.hs:45:1) + In the first argument of ‘goo4’, namely ‘(goo3 False undefined)’ + In the expression: goo4 (goo3 False undefined) + In an equation for ‘test4’: test4 = goo4 (goo3 False undefined) + +FrozenErrorTests.hs:46:9: + Couldn't match type ‘T2 c c’ with ‘M (T2 (T2 c c) c)’ + Expected type: T2 (M (T2 (T2 c c) c)) (T2 (T2 c c) c) + Actual type: F (T2 (T2 c c) c) Bool + Relevant bindings include + test5 :: T2 (T2 c c) c (bound at FrozenErrorTests.hs:46:1) + In the expression: goo3 False (goo4 undefined) + In an equation for ‘test5’: test5 = goo3 False (goo4 undefined) diff --git a/testsuite/tests/typecheck/should_fail/T5858.stderr b/testsuite/tests/typecheck/should_fail/T5858.stderr index 9cd1deee69..1378bae9c2 100644 --- a/testsuite/tests/typecheck/should_fail/T5858.stderr +++ b/testsuite/tests/typecheck/should_fail/T5858.stderr @@ -4,7 +4,7 @@ T5858.hs:11:7: arising from a use of ‘infer’ The type variables ‘t0’, ‘t1’ are ambiguous Note: there is a potential instance available: - instance t1 ~ String => InferOverloaded (t1, t1) + instance (t1 ~ String) => InferOverloaded (t1, t1) -- Defined at T5858.hs:8:10 In the expression: infer ([], []) In an equation for ‘foo’: foo = infer ([], []) diff --git a/testsuite/tests/typecheck/should_fail/T7857.stderr b/testsuite/tests/typecheck/should_fail/T7857.stderr index 3519b3fa8d..6517b774f9 100644 --- a/testsuite/tests/typecheck/should_fail/T7857.stderr +++ b/testsuite/tests/typecheck/should_fail/T7857.stderr @@ -8,7 +8,7 @@ T7857.hs:8:11: Note: there are several potential instances: instance [safe] (PrintfArg a, PrintfType r) => PrintfType (a -> r) -- Defined in ‘Text.Printf’ - instance [safe] a ~ () => PrintfType (IO a) + instance [safe] (a ~ ()) => PrintfType (IO a) -- Defined in ‘Text.Printf’ instance [safe] IsChar c => PrintfType [c] -- Defined in ‘Text.Printf’ diff --git a/testsuite/tests/typecheck/should_fail/T8392a.stderr b/testsuite/tests/typecheck/should_fail/T8392a.stderr index ed33600a1e..9be12a5b0b 100644 --- a/testsuite/tests/typecheck/should_fail/T8392a.stderr +++ b/testsuite/tests/typecheck/should_fail/T8392a.stderr @@ -2,6 +2,6 @@ T8392a.hs:6:8: Couldn't match type ‘Int’ with ‘Bool’ Inaccessible code in - the type signature for foo :: Int ~ Bool => a -> a - In the ambiguity check for: forall a. Int ~ Bool => a -> a + the type signature for foo :: (Int ~ Bool) => a -> a + In the ambiguity check for: forall a. (Int ~ Bool) => a -> a In the type signature for ‘foo’: foo :: (Int ~ Bool) => a -> a |