diff options
author | Martin Odersky <odersky@gmail.com> | 2013-12-20 11:33:05 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-12-20 11:38:39 +0100 |
commit | 146a362bf74418feeb18e12c34178819ecb64942 (patch) | |
tree | 2dec7acd61107a673ce859450cccfad9b50dba88 /src/dotty/tools/dotc/printing | |
parent | bac6a2081d971c7f5c87b610cfaac7cd39c06713 (diff) | |
download | dotty-146a362bf74418feeb18e12c34178819ecb64942.tar.gz dotty-146a362bf74418feeb18e12c34178819ecb64942.tar.bz2 dotty-146a362bf74418feeb18e12c34178819ecb64942.zip |
Handling implicit unapply arguments.
Changed format of UnApply nodes to also take implicit parameters. See doc comment in class Trees.UnApply
Diffstat (limited to 'src/dotty/tools/dotc/printing')
-rw-r--r-- | src/dotty/tools/dotc/printing/RefinedPrinter.scala | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala index b4221d7eb..3636731aa 100644 --- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala +++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala @@ -241,8 +241,14 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { changePrec(InfixPrec) { toText(name) ~ " @ " ~ toText(body) } case Alternative(trees) => changePrec(OrPrec) { toText(trees, " | ") } - case UnApply(fun, args) => - toTextLocal(fun) ~ "(" ~ toTextGlobal(args, ", ") ~ ")" + case UnApply(fun, implicits, patterns) => + val extractor = fun match { + case Select(extractor, nme.unapply) => extractor + case _ => fun + } + toTextLocal(extractor) ~ + "(" ~ toTextGlobal(patterns, ", ") ~ ")" ~ + ("(" ~ toTextGlobal(implicits, ", ") ~ ")" provided implicits.nonEmpty) case ValDef(mods, name, tpt, rhs) => modText(mods, if (mods is Mutable) "var" else "val") ~~ toText(name) ~ optAscription(tpt) ~ optText(rhs)(" = " ~ _) |