diff options
author | Paul Phillips <paulp@improving.org> | 2012-01-12 09:17:26 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-01-12 10:06:00 -0800 |
commit | ccb590c0378819011640a58b822fbdeb938144dc (patch) | |
tree | 6b92649121c4fdbfe851d266a5002d8eb892ff34 /src | |
parent | 15372027c762b18bccf231b9810e9db3415e7f5a (diff) | |
download | scala-ccb590c0378819011640a58b822fbdeb938144dc.tar.gz scala-ccb590c0378819011640a58b822fbdeb938144dc.tar.bz2 scala-ccb590c0378819011640a58b822fbdeb938144dc.zip |
Disambiguate some type printing.
Functions of functions use parens for grouping.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/reflect/internal/Types.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala index 6d4332216c..fa62d00c6a 100644 --- a/src/compiler/scala/reflect/internal/Types.scala +++ b/src/compiler/scala/reflect/internal/Types.scala @@ -2095,8 +2095,11 @@ trait Types extends api.Types { self: SymbolTable => // ...but only if it's not a tuple, so ((T1, T2)) => R is distinguishable // from (T1, T2) => R. targs match { - case in :: out :: Nil if !isTupleTypeOrSubtype(in) => - "" + in + " => " + out + case in :: out :: Nil if !isTupleTypeOrSubtype(in) => + // A => B => C should be (A => B) => C or A => (B => C) + val in_s = if (isFunctionType(in)) "(" + in + ")" else "" + in + val out_s = if (isFunctionType(out)) "(" + out + ")" else "" + out + in_s + " => " + out_s case xs => xs.init.mkString("(", ", ", ")") + " => " + xs.last } |