diff options
author | Paul Phillips <paulp@improving.org> | 2011-10-09 19:24:26 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-10-09 19:24:26 +0000 |
commit | 2c1a1192ce19f84984eb52037fba5b26794ed3fa (patch) | |
tree | 07fde350be49609db48fe4bb8db26c1f7b42b6e4 /src | |
parent | 2adf5a0613c332045b65687a1f1e8a3fe8dd0222 (diff) | |
download | scala-2c1a1192ce19f84984eb52037fba5b26794ed3fa.tar.gz scala-2c1a1192ce19f84984eb52037fba5b26794ed3fa.tar.bz2 scala-2c1a1192ce19f84984eb52037fba5b26794ed3fa.zip |
Fix for error printing regression.
One's devotion to aesthetics must not be allowed to trump one's
commitment to clearly delineated tuplehood. Closes SI-5067, no review.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/reflect/internal/Types.scala | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala index a7a5efe21a..c313f079ae 100644 --- a/src/compiler/scala/reflect/internal/Types.scala +++ b/src/compiler/scala/reflect/internal/Types.scala @@ -2030,12 +2030,14 @@ A type's typeSymbol should never be inspected directly. if (isFunctionType(this)) { val targs = normalize.typeArgs // Aesthetics: printing Function1 as T => R rather than (T) => R - val paramlist = targs.init match { - case Nil => "()" - case x :: Nil => "" + x - case xs => xs.mkString("(", ", ", ")") + // ...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 xs => + xs.init.mkString("(", ", ", ")") + " => " + xs.last } - paramlist + " => " + targs.last } else if (isTupleTypeOrSubtype(this)) normalize.typeArgs.mkString("(", ", ", if (hasLength(normalize.typeArgs, 1)) ",)" else ")") |