File tree Expand file tree Collapse file tree 2 files changed +4
-10
lines changed
repl-shaded/src/scala/tools/repl
repl/src/dotty/tools/repl Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,7 @@ class UnshadingClassLoader(parent: ClassLoader) extends ClassLoader(parent) {
2121 if (loaded != null ) return loaded
2222
2323 val shadedPath = (SHADED_PREFIX + name).replace('.' , '/' ) + " .class"
24- val is0 = try {
25- Option (super .getResourceAsStream(shadedPath))
26- }catch {
27- case _ : Exception => None
28- }
24+ val is0 = scala.util.Try (Option (super .getResourceAsStream(shadedPath))).toOption.flatten
2925
3026 is0 match {
3127 case Some (is) =>
@@ -60,19 +56,17 @@ object EmbeddedReplMain {
6056 else Array (" -classpath" , System .getProperty(" java.class.path" )) ++ args
6157
6258 val unshadingClassLoader = new UnshadingClassLoader (getClass.getClassLoader)
63-
6459 val replDriverClass = unshadingClassLoader.loadClass(" dotty.tools.repl.ReplDriver" )
65-
6660 val someCls = unshadingClassLoader.loadClass(" scala.Some" )
61+ val pprintImport = replDriverClass.getMethod(" pprintImport" ).invoke(null )
6762
6863 val replDriver = replDriverClass.getConstructors().head.newInstance(
6964 /* settings*/ argsWithClasspath,
7065 /* out*/ System .out,
7166 /* classLoader*/ someCls.getConstructors().head.newInstance(getClass.getClassLoader),
72- /* extraPredef*/ " "
67+ /* extraPredef*/ pprintImport
7368 )
7469
7570 replDriverClass.getMethod(" tryRunning" ).invoke(replDriver)
76-
7771 }
7872}
Original file line number Diff line number Diff line change @@ -706,4 +706,4 @@ class ReplDriver(settings: Array[String],
706706
707707end ReplDriver
708708object ReplDriver :
709- def pprintImport = " import pprint.pprintln\n "
709+ def pprintImport = " import dotty.shaded. pprint.pprintln\n "
You can’t perform that action at this time.
0 commit comments