Skip to content

Commit 31a4810

Browse files
committed
Remove more duplication from UserFacingPrinter
1 parent dd50209 commit 31a4810

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

repl/src/dotty/tools/repl/ReplDriver.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ import results._
4949
* @param valIndex the index of next value binding for free expressions
5050
* @param history a list of user inputs as strings
5151
* @param imports a list of tuples of imports on tree form and shown form
52-
* @param run TODO
53-
*
52+
* @param run the latest run initiated at the start of interpretation. This
53+
* run and its context should be used in order to perform any
54+
* manipulation on `Tree`s and `Symbol`s.
5455
*/
5556
case class State(objectIndex: Int,
5657
valIndex: Int,
@@ -70,7 +71,6 @@ case class State(objectIndex: Int,
7071
*
7172
* @param cursor the index of the users cursor in the input
7273
* @param suggestions the suggested completions as a filtered list of strings
73-
* @param details should be a list of signatures for the suggestions, TODO
7474
*/
7575
case class Completions(cursor: Int,
7676
suggestions: List[String],

repl/src/dotty/tools/repl/UserFacingPrinter.scala

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,15 @@ class UserFacingPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
4040
pkgSym.name.isReplWrapperName
4141
}
4242

43-
// FIXME
44-
override def kindString(sym: Symbol): String = {
43+
override protected def keyString(sym: Symbol): String = {
4544
val flags = sym.flags
4645
if (flags is Package) ""
4746
else if (sym.isPackageObject) "package object"
4847
else if (flags.is(Module) && flags.is(Case)) "case object"
49-
else if (flags is Module) "object"
50-
else if (flags is ImplClass) "class"
51-
else if (flags.is(Trait)) "trait"
5248
else if (sym.isClass && flags.is(Case)) "case class"
53-
else if (sym.isClass) "class"
54-
else if (sym.isType) "type"
5549
else if (flags.is(Lazy)) "lazy val"
56-
else if (flags.is(Mutable)) "var"
57-
else if (sym.is(Method)) "def"
58-
else if (sym.isTerm) "val"
59-
else super.kindString(sym)
50+
else if (flags is Module) "object"
51+
else super.keyString(sym)
6052
}
6153

6254
override def nameString(name: Name): String =
@@ -65,7 +57,7 @@ class UserFacingPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
6557

6658
override def toText(sym: Symbol): Text =
6759
if (sym.name.isReplAssignName) nameString(sym.name)
68-
else kindString(sym) ~~ nameString(sym.name.stripModuleClassSuffix)
60+
else keyString(sym) ~~ nameString(sym.name.stripModuleClassSuffix)
6961

7062
override def dclText(sym: Symbol): Text =
7163
toText(sym) ~ {

0 commit comments

Comments
 (0)