Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
48089ccf
Commit
48089ccf
authored
Oct 02, 2014
by
Simon Peyton Jones
Browse files
Use correct precedence when printing contexts with class operators
Fixes Trac
#9658
parent
2b59c7ac
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
101 additions
and
91 deletions
+101
-91
compiler/types/TypeRep.lhs
compiler/types/TypeRep.lhs
+4
-1
testsuite/tests/gadt/T7558.stderr
testsuite/tests/gadt/T7558.stderr
+1
-1
testsuite/tests/ghci/scripts/Defer02.stderr
testsuite/tests/ghci/scripts/Defer02.stderr
+4
-4
testsuite/tests/ghci/scripts/T9658.script
testsuite/tests/ghci/scripts/T9658.script
+4
-0
testsuite/tests/ghci/scripts/T9658.stdout
testsuite/tests/ghci/scripts/T9658.stdout
+1
-0
testsuite/tests/ghci/scripts/all.T
testsuite/tests/ghci/scripts/all.T
+1
-0
testsuite/tests/indexed-types/should_compile/Simple14.stderr
testsuite/tests/indexed-types/should_compile/Simple14.stderr
+18
-18
testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.stderr
...uite/tests/indexed-types/should_fail/ExtraTcsUntch.stderr
+1
-1
testsuite/tests/indexed-types/should_fail/SimpleFail15.stderr
...suite/tests/indexed-types/should_fail/SimpleFail15.stderr
+1
-1
testsuite/tests/indexed-types/should_fail/T2239.stderr
testsuite/tests/indexed-types/should_fail/T2239.stderr
+2
-2
testsuite/tests/indexed-types/should_fail/T4093a.stderr
testsuite/tests/indexed-types/should_fail/T4093a.stderr
+2
-2
testsuite/tests/perf/compiler/T5837.stderr
testsuite/tests/perf/compiler/T5837.stderr
+1
-1
testsuite/tests/polykinds/T7230.stderr
testsuite/tests/polykinds/T7230.stderr
+2
-1
testsuite/tests/roles/should_compile/Roles3.stderr
testsuite/tests/roles/should_compile/Roles3.stderr
+1
-1
testsuite/tests/typecheck/should_fail/ContextStack2.stderr
testsuite/tests/typecheck/should_fail/ContextStack2.stderr
+1
-1
testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr
...suite/tests/typecheck/should_fail/FrozenErrorTests.stderr
+53
-53
testsuite/tests/typecheck/should_fail/T5858.stderr
testsuite/tests/typecheck/should_fail/T5858.stderr
+1
-1
testsuite/tests/typecheck/should_fail/T7857.stderr
testsuite/tests/typecheck/should_fail/T7857.stderr
+1
-1
testsuite/tests/typecheck/should_fail/T8392a.stderr
testsuite/tests/typecheck/should_fail/T8392a.stderr
+2
-2
No files found.
compiler/types/TypeRep.lhs
View file @
48089ccf
...
...
@@ -537,7 +537,10 @@ pprTheta theta = parens (sep (punctuate comma (map (ppr_type TopPrec) theta)))
pprThetaArrowTy :: ThetaType -> SDoc
pprThetaArrowTy [] = empty
pprThetaArrowTy [pred] = ppr_type FunPrec pred <+> darrow
pprThetaArrowTy [pred] = ppr_type TyOpPrec pred <+> darrow
-- TyOpPrec: Num a => a -> a does not need parens
-- bug (a :~: b) => a -> b currently does
-- Trac # 9658
pprThetaArrowTy preds = parens (fsep (punctuate comma (map (ppr_type TopPrec) preds)))
<+> darrow
-- Notice 'fsep' here rather that 'sep', so that
...
...
testsuite/tests/gadt/T7558.stderr
View file @
48089ccf
...
...
@@ -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)
...
...
testsuite/tests/ghci/scripts/Defer02.stderr
View file @
48089ccf
...
...
@@ -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’
...
...
testsuite/tests/ghci/scripts/T9658.script
0 → 100644
View file @
48089ccf
:set -XTypeOperators
:set -XMultiParamTypeClasses
class a :-: b where op :: a -> b
:t op
testsuite/tests/ghci/scripts/T9658.stdout
0 → 100644
View file @
48089ccf
op :: (a :-: b) => a -> b
testsuite/tests/ghci/scripts/all.T
View file @
48089ccf
...
...
@@ -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
'])
testsuite/tests/indexed-types/should_compile/Simple14.stderr
View file @
48089ccf
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))
testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.stderr
View file @
48089ccf
...
...
@@ -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])
...
...
testsuite/tests/indexed-types/should_fail/SimpleFail15.stderr
View file @
48089ccf
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)
testsuite/tests/indexed-types/should_fail/T2239.stderr
View file @
48089ccf
...
...
@@ -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 ::
...
...
testsuite/tests/indexed-types/should_fail/T4093a.stderr
View file @
48089ccf
...
...
@@ -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 ()
...
...
testsuite/tests/perf/compiler/T5837.stderr
View file @
48089ccf
...
...
@@ -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
testsuite/tests/polykinds/T7230.stderr
View file @
48089ccf
...
...
@@ -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
...
...
testsuite/tests/roles/should_compile/Roles3.stderr
View file @
48089ccf
...
...
@@ -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: []
...
...
testsuite/tests/typecheck/should_fail/ContextStack2.stderr
View file @
48089ccf
...
...
@@ -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
testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr
View file @
48089ccf
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)
testsuite/tests/typecheck/should_fail/T5858.stderr
View file @
48089ccf
...
...
@@ -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 ([], [])
testsuite/tests/typecheck/should_fail/T7857.stderr
View file @
48089ccf
...
...
@@ -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’
...
...
testsuite/tests/typecheck/should_fail/T8392a.stderr
View file @
48089ccf
...
...
@@ -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
Administrator
@root
mentioned in commit
d71f316e
·
Dec 17, 2018
mentioned in commit
d71f316e
mentioned in commit d71f316ef4acb6a967a1f07bc4c1144e553a3ac9
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment