File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ package repl
44import dotc .typer .FrontEnd
55import dotc .CompilationUnit
66import dotc .core .Contexts ._
7- import dotc .typer .ImportInfo .withRootImports
87
98/** A customized `FrontEnd` for the REPL
109 *
@@ -19,7 +18,7 @@ private[repl] class REPLFrontEnd extends FrontEnd {
1918 override def runOn (units : List [CompilationUnit ])(using Context ): List [CompilationUnit ] = {
2019 assert(units.size == 1 ) // REPl runs one compilation unit at a time
2120 val unit = units.head
22- val unitContext = ctx.fresh.setCompilationUnit(unit).withRootImports
21+ val unitContext = ctx.fresh.setCompilationUnit(unit)
2322 enterSyms(using unitContext)
2423 typeCheck(using unitContext)
2524 List (unit)
Original file line number Diff line number Diff line change 1+ scala> class Appendable { def foo = println("Appendable.foo") }
2+ // defined class Appendable
3+
4+ scala> (new Appendable).foo
5+ Appendable.foo
6+
7+ scala> def assert(x: Boolean) = println(if x then "not asserted" else "asserted")
8+ def assert(x: Boolean): Unit
9+
10+ scala> assert(false)
11+ asserted
12+
13+ scala> class Option; object Option { val baz = 42 }
14+ // defined class Option
15+ // defined object Option
16+
17+ scala> Option.baz
18+ val res0: Int = 42
19+
20+ scala> object fs2 { class Stream[T] { override def toString = "fs2.Stream(..)" }; object Stream { def apply[T](x: T) = new Stream[T] }}
21+ // defined object fs2
22+
23+ scala> import fs2.Stream
24+ scala> Stream(1)
25+ val res1: fs2.Stream[Int] = fs2.Stream(..)
You can’t perform that action at this time.
0 commit comments