diff --git a/compiler/src/dotty/tools/dotc/repl/CompilingInterpreter.scala b/compiler/src/dotty/tools/dotc/repl/CompilingInterpreter.scala index ca38ba10777a..85f47692f4fa 100644 --- a/compiler/src/dotty/tools/dotc/repl/CompilingInterpreter.scala +++ b/compiler/src/dotty/tools/dotc/repl/CompilingInterpreter.scala @@ -724,7 +724,7 @@ class CompilingInterpreter( | if ($fullPath.asInstanceOf[AnyRef] != null) { | (if ($fullPath.toString().contains('\\n')) "\\n" else "") + { | import dotty.Show._ - | $fullPath.show /*toString()*/ + "\\n" + | (new ShowValue($fullPath)).show /*toString()*/ + "\\n" | } | } else { | "null\\n" diff --git a/tests/repl/showMethod.check b/tests/repl/showMethod.check new file mode 100644 index 000000000000..428e3a2f6ed1 --- /dev/null +++ b/tests/repl/showMethod.check @@ -0,0 +1,9 @@ +scala> class A { def show = "hello"; override def toString = "A" } +defined class A +scala> new A +val res0: A = A +scala> class B { def show() = "hello"; override def toString = "B" } +defined class B +scala> new B +val res1: B = B +scala> :quit