File tree 1 file changed +8
-5
lines changed
repl/src/dotty/tools/repl
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
12
12
object Rendering {
13
13
/** Load the value of the symbol using reflection */
14
14
private [this ] def valueOf (sym : Symbol , classLoader : ClassLoader )(implicit ctx : Context ): String = {
15
+ val defn = ctx.definitions
15
16
val objectName = sym.owner.fullName.encode.toString
16
17
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
+ }
22
25
}
23
26
24
27
def renderMethod (d : Denotation )(implicit ctx : Context ): String = {
You can’t perform that action at this time.
0 commit comments