File tree 2 files changed +26
-2
lines changed
2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ package repl
4
4
import dotc .typer .FrontEnd
5
5
import dotc .CompilationUnit
6
6
import dotc .core .Contexts ._
7
- import dotc .typer .ImportInfo .withRootImports
8
7
9
8
/** A customized `FrontEnd` for the REPL
10
9
*
@@ -19,7 +18,7 @@ private[repl] class REPLFrontEnd extends FrontEnd {
19
18
override def runOn (units : List [CompilationUnit ])(using Context ): List [CompilationUnit ] = {
20
19
assert(units.size == 1 ) // REPl runs one compilation unit at a time
21
20
val unit = units.head
22
- val unitContext = ctx.fresh.setCompilationUnit(unit).withRootImports
21
+ val unitContext = ctx.fresh.setCompilationUnit(unit)
23
22
enterSyms(using unitContext)
24
23
typeCheck(using unitContext)
25
24
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