File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
repl/src/dotty/tools/repl Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,16 @@ import dotc.core.Symbols.Symbol
1212object Rendering {
1313 /** Load the value of the symbol using reflection */
1414 private [this ] def valueOf (sym : Symbol , classLoader : ClassLoader )(implicit ctx : Context ): String = {
15+ val defn = ctx.definitions
1516 val objectName = sym.owner.fullName.encode.toString
1617 val resObj : Class [_] = Class .forName(objectName, true , classLoader)
17- val objInstance = resObj.newInstance()
18- objInstance
19- .getClass()
20- .getDeclaredMethods.find(_.getName == sym.name.encode.toString).get
21- .invoke(objInstance).toString
18+
19+ if (! sym.is(Flags .Method ) && sym.info == defn.UnitType ) " ()"
20+ else {
21+ resObj
22+ .getDeclaredMethods.find(_.getName == sym.name.encode.toString).get
23+ .invoke(null ).toString
24+ }
2225 }
2326
2427 def renderMethod (d : Denotation )(implicit ctx : Context ): String = {
You can’t perform that action at this time.
0 commit comments