Skip to content

Commit eeff384

Browse files
authored
Merge pull request #3959 from eklavya/master
Fixes #3860 REPL pretty-printed output for by-name parameters
2 parents 96e7f7d + e54524a commit eeff384

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

+2
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
326326
"} at " ~ preText
327327
case mt: MethodType =>
328328
toTextGlobal(mt)
329+
case tp: ExprType =>
330+
": => " ~ toTextGlobal(tp.widenExpr)
329331
case tp =>
330332
": " ~ toTextGlobal(tp)
331333
}

compiler/test/dotty/tools/repl/ReplCompilerTests.scala

+5
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,9 @@ class ReplCompilerTests extends ReplTest {
120120
compile("(x: Int) => println(x)")
121121
assertTrue(storedOutput().startsWith("val res0: Int => Unit ="))
122122
}
123+
124+
@Test def byNameParam: Unit = fromInitialState { implicit state =>
125+
compile("def f(g: => Int): Int = g")
126+
assertTrue(storedOutput().startsWith("def f(g: => Int): Int"))
127+
}
123128
}

0 commit comments

Comments
 (0)