Skip to content

Commit 8b7a7ea

Browse files
committed
Print List and Map abbreviated
1 parent 8bb9c84 commit 8b7a7ea

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

compiler/src/dotty/tools/dotc/repl/CompilingInterpreter.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,9 +683,16 @@ class CompilingInterpreter(
683683
code.print(resultExtractors.mkString(""))
684684
}
685685

686+
private val ListReg = """^.*List\[(\w+)\]$""".r
687+
private val MapReg = """^.*Map\[(\w+),[ ]*(\w+)\]$""".r
688+
686689
private def resultExtractor(req: Request, varName: Name): String = {
687690
val prettyName = varName.decode
688-
val varType = string2code(req.typeOf(varName))
691+
val varType = string2code(req.typeOf(varName)) match {
692+
case ListReg(param) => s"List[$param]"
693+
case MapReg(k, v) => s"Map[$k, $v]"
694+
case x => x
695+
}
689696
val fullPath = req.fullPath(varName)
690697

691698
val varOrVal = statement match {

0 commit comments

Comments
 (0)