From 146a362bf74418feeb18e12c34178819ecb64942 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 20 Dec 2013 11:33:05 +0100 Subject: Handling implicit unapply arguments. Changed format of UnApply nodes to also take implicit parameters. See doc comment in class Trees.UnApply --- src/dotty/tools/dotc/printing/RefinedPrinter.scala | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc/printing/RefinedPrinter.scala') 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)(" = " ~ _) -- cgit v1.2.3