Skip to content

Commit 8e43258

Browse files
Merge pull request #8995 from rjolly/master
Provide script engine rendering object with parent class loader
2 parents 93132bd + 3d96984 commit 8e43258

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

compiler/src/dotty/tools/repl/ScriptEngine.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ScriptEngine extends AbstractScriptEngine {
2424
"-color:never",
2525
"-Xrepl-disable-display"
2626
), Console.out, None)
27-
private val rendering = new Rendering
27+
private val rendering = new Rendering(Some(getClass.getClassLoader))
2828
private var state: State = driver.initialState
2929

3030
def getFactory: ScriptEngineFactory = new ScriptEngine.Factory
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
42
2+
42

tests/run-with-compiler/scripting.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ object Test {
33
val m = new javax.script.ScriptEngineManager(getClass().getClassLoader())
44
val e = m.getEngineByName("scala")
55
println(e.eval("42"))
6+
println(e.eval("Some(42)").asInstanceOf[Option[Int]].get)
67
}
78
}

0 commit comments

Comments
 (0)