From e54524a3108561270db96cafcbcdf6ec5cc50cf3 Mon Sep 17 00:00:00 2001 From: Saurabh Rawat Date: Sun, 4 Feb 2018 18:55:41 +0530 Subject: [PATCH] Fixes #3860 REPL pretty-printed output for by-name parameters --- compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala | 2 ++ compiler/test/dotty/tools/repl/ReplCompilerTests.scala | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala index f5f503207e05..1c04a03605a1 100644 --- a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -326,6 +326,8 @@ class PlainPrinter(_ctx: Context) extends Printer { "} at " ~ preText case mt: MethodType => toTextGlobal(mt) + case tp: ExprType => + ": => " ~ toTextGlobal(tp.widenExpr) case tp => ": " ~ toTextGlobal(tp) } diff --git a/compiler/test/dotty/tools/repl/ReplCompilerTests.scala b/compiler/test/dotty/tools/repl/ReplCompilerTests.scala index d44da3201f9e..855e781ff61a 100644 --- a/compiler/test/dotty/tools/repl/ReplCompilerTests.scala +++ b/compiler/test/dotty/tools/repl/ReplCompilerTests.scala @@ -120,4 +120,9 @@ class ReplCompilerTests extends ReplTest { compile("(x: Int) => println(x)") assertTrue(storedOutput().startsWith("val res0: Int => Unit =")) } + + @Test def byNameParam: Unit = fromInitialState { implicit state => + compile("def f(g: => Int): Int = g") + assertTrue(storedOutput().startsWith("def f(g: => Int): Int")) + } }