Skip to content

Commit e331f87

Browse files
committed
Inline repl project into dotty-compiler
As discussed with @smarter, this has the effect that if you depend on dotty-compiler version X, you also get the appropriate dotty repl with the same version
1 parent 2ae1814 commit e331f87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4
-56
lines changed

build.sbt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ val `dotty-bench-bootstrapped` = Build.`dotty-bench-bootstrapped`
1818
val `scala-library` = Build.`scala-library`
1919
val `scala-compiler` = Build.`scala-compiler`
2020
val `scala-reflect` = Build.`scala-reflect`
21-
val `dotty-repl` = Build.`dotty-repl`
2221
val scalap = Build.scalap
2322
val dist = Build.dist
2423
val `dist-bootstrapped` = Build.`dist-bootstrapped`

repl/src/dotty/tools/repl/UserFacingPrinter.scala renamed to compiler/src/dotty/tools/repl/UserFacingPrinter.scala

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ import dotc.core.Symbols.{ Symbol, ClassSymbol, defn }
1717
import dotc.core.SymDenotations.NoDenotation
1818
import dotc.core.Types._
1919
import dotc.printing.Texts._
20-
import dotc.printing.{ GlobalPrec, DotPrec, Printer, PlainPrinter }
20+
import dotc.printing.{ GlobalPrec, DotPrec, Printer, PlainPrinter, RefinedPrinter }
2121
import dotc.typer.Implicits.SearchResult
2222
import dotc.typer.ImportInfo
2323

24-
class UserFacingPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
24+
class UserFacingPrinter(_ctx: Context) extends RefinedPrinter(_ctx) {
2525

2626
private def panic(msg: String): Nothing = throw new AssertionError(msg)
2727

@@ -75,15 +75,6 @@ class UserFacingPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
7575
}
7676
}
7777

78-
override def toText(denot: Denotation): Text = denot match {
79-
case NoDenotation =>
80-
panic("NoDenotation encountered in UserFacingPrinter")
81-
case denot: MultiDenotation =>
82-
panic("MultiDenotation not allowed in UserFacingPrinter")
83-
case _ =>
84-
toText(denot.symbol)
85-
}
86-
8778
override def toText(const: Constant): Text = Str(const.value.toString)
8879

8980
override def toText(tp: Type): Text = tp match {
@@ -142,7 +133,6 @@ class UserFacingPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
142133
printPkg(tp.cls.owner.asClass) ~ "." ~ nameString(tp.cls.name)
143134
}
144135
}
136+
case tp => super.toText(tp)
145137
}
146-
147-
override lazy val plain = new PlainPrinter(_ctx)
148138
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

project/Build.scala

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ object Build {
130130
javaSource in Compile := baseDirectory.value / "src",
131131
javaSource in Test := baseDirectory.value / "test",
132132
resourceDirectory in Compile := baseDirectory.value / "resources",
133+
resourceDirectory in Test := baseDirectory.value / "test-resources",
133134

134135
// Prevent sbt from rewriting our dependencies
135136
ivyScala ~= (_ map (_ copy (overrideScalaVersion = false)))
@@ -358,47 +359,6 @@ object Build {
358359
)
359360
)
360361

361-
lazy val `dotty-repl` = project.in(file("repl")).
362-
dependsOn(
363-
`dotty-compiler`,
364-
`dotty-compiler` % "test->test"
365-
).
366-
settings(commonNonBootstrappedSettings).
367-
settings(
368-
// set system in/out for repl
369-
connectInput in run := true,
370-
outputStrategy := Some(StdoutOutput),
371-
372-
// enable verbose exception messages for JUnit
373-
testOptions in Test += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"),
374-
375-
resourceDirectory in Test := baseDirectory.value / "test-resources",
376-
377-
run := Def.inputTaskDyn {
378-
val classPath =
379-
(packageAll in `dotty-compiler-bootstrapped`).value("dotty-library") + ":" +
380-
(packageAll in `dotty-compiler-bootstrapped`).value("dotty-interfaces")
381-
382-
val args: Seq[String] = spaceDelimited("<arg>").parsed
383-
384-
val fullArgs = args.span(_ != "-classpath") match {
385-
case (beforeCp, Nil) => beforeCp ++ ("-classpath" :: classPath :: Nil)
386-
case (beforeCp, rest) => beforeCp ++ rest
387-
}
388-
389-
(runMain in Compile).toTask(
390-
s" dotty.tools.repl.Main " + fullArgs.mkString(" ")
391-
)
392-
}.evaluated,
393-
394-
repl := run.evaluated,
395-
396-
javaOptions ++= (javaOptions in `dotty-compiler`).value,
397-
fork in run := true,
398-
fork in Test := true,
399-
parallelExecution in Test := false
400-
)
401-
402362
lazy val `dotty-doc` = project.in(file("doc-tool")).
403363
dependsOn(`dotty-compiler`, `dotty-compiler` % "test->test").
404364
settings(commonNonBootstrappedSettings).
@@ -409,7 +369,6 @@ object Build {
409369
settings(commonBootstrappedSettings).
410370
settings(dottyDocSettings)
411371

412-
413372
lazy val `dotty-bot` = project.in(file("bot")).
414373
settings(commonScala2Settings).
415374
settings(

0 commit comments

Comments
 (0)