diff options
author | Martin Odersky <odersky@gmail.com> | 2017-02-14 16:38:48 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-02-14 16:52:13 +0100 |
commit | 17469b82ca7afc5376bc3906bb5b64d10f38a100 (patch) | |
tree | a2f82eb455c47af697a5786b1eb6a70f7a2ad14a | |
parent | 47901c09885f8931d82a3bbc469985a50f790091 (diff) | |
download | dotty-17469b82ca7afc5376bc3906bb5b64d10f38a100.tar.gz dotty-17469b82ca7afc5376bc3906bb5b64d10f38a100.tar.bz2 dotty-17469b82ca7afc5376bc3906bb5b64d10f38a100.zip |
Tweak printing of polymrophic methods
Omit the `=>' if a PolyType has a MethodType as result type.
-rw-r--r-- | compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala | 3 | ||||
-rw-r--r-- | tests/neg/i1747.scala | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala index ac25f7cfd..1c3ff8ea0 100644 --- a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -177,7 +177,8 @@ class PlainPrinter(_ctx: Context) extends Printer { varianceString(variance) ~ name.toString ~ toText(bounds) changePrec(GlobalPrec) { "[" ~ Text((tp.variances, tp.paramNames, tp.paramBounds).zipped.map(paramText), ", ") ~ - "] => " ~ toTextGlobal(tp.resultType) + "]" ~ (" => " provided !tp.resultType.isInstanceOf[MethodType]) ~ + toTextGlobal(tp.resultType) } case tp: PolyParam => polyParamNameString(tp) ~ polyHash(tp.binder) diff --git a/tests/neg/i1747.scala b/tests/neg/i1747.scala new file mode 100644 index 000000000..9675de992 --- /dev/null +++ b/tests/neg/i1747.scala @@ -0,0 +1,3 @@ +class Coll[E] extends java.util.Collection[E] { + def toArray[T](a: Array[T]): Array[T] = ??? // error: cannot override +} |