Skip to content

Super Bootstrap: Make dottydoc part of the bootstrap #2082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,30 @@ trait TypeTestsCasts {
/** Transform isInstanceOf OrType
*
* expr.isInstanceOf[A | B] ~~> expr.isInstanceOf[A] | expr.isInstanceOf[B]
* expr.isInstanceOf[A & B] ~~> expr.isInstanceOf[A] & expr.isInstanceOf[B]
*
* The transform happens before erasure of `argType`, thus cannot be merged
* with `transformIsInstanceOf`, which depends on erased type of `argType`.
*/
def transformOrTypeTest(qual: Tree, argType: Type): Tree = argType.dealias match {
def transformTypeTest(qual: Tree, argType: Type): Tree = argType.dealias match {
case OrType(tp1, tp2) =>
evalOnce(qual) { fun =>
transformOrTypeTest(fun, tp1)
.select(nme.OR)
.appliedTo(transformOrTypeTest(fun, tp2))
transformTypeTest(fun, tp1)
.select(defn.Boolean_||)
.appliedTo(transformTypeTest(fun, tp2))
}
case AndType(tp1, tp2) =>
evalOnce(qual) { fun =>
transformTypeTest(fun, tp1)
.select(defn.Boolean_&&)
.appliedTo(transformTypeTest(fun, tp2))
}
case _ =>
transformIsInstanceOf(qual, erasure(argType))
}

if (sym eq defn.Any_isInstanceOf)
transformOrTypeTest(qual, tree.args.head.tpe)
transformTypeTest(qual, tree.args.head.tpe)
else if (sym eq defn.Any_asInstanceOf)
transformAsInstanceOf(erasure(tree.args.head.tpe))
else tree
Expand Down
3 changes: 2 additions & 1 deletion doc-tool/test/JavaConverterTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ class JavaConverterTest {
}

def assertEach[E, C[E] <: Seq[E]](expected: C[E], serialized: Any)(pairwiseAssertion: (E, Any) => Unit): Unit = {
val actual = serialized.asInstanceOf[JList[_]].asScala.toList
val s = serialized.asInstanceOf[JList[_]]
val actual = s.asScala.toList
assertEquals(expected.length, actual.length)
for ((exp, act) <- expected zip actual) {
pairwiseAssertion(exp, act)
Expand Down
21 changes: 10 additions & 11 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,16 @@ object DottyBuild extends Build {

// Settings shared between dotty-compiler and dotty-compiler-bootstrapped
lazy val dottyCompilerSettings = Seq(

// necessary evil: dottydoc currently needs to be included in the dotty
// project, for sbt integration
unmanagedResourceDirectories in Compile := Seq((resourceDirectory in Compile).value),
unmanagedResourceDirectories in Compile += baseDirectory.value / ".." / "doc-tool" / "resources",
unmanagedSourceDirectories in Compile := Seq((scalaSource in Compile).value),
unmanagedSourceDirectories in Compile += baseDirectory.value / ".." / "doc-tool" / "src",
unmanagedSourceDirectories in Test := Seq((scalaSource in Test).value),
unmanagedSourceDirectories in Test += baseDirectory.value / ".." / "doc-tool" / "test",

// set system in/out for repl
connectInput in run := true,
outputStrategy := Some(StdoutOutput),
Expand Down Expand Up @@ -448,17 +458,6 @@ object DottyBuild extends Build {
settings(
overrideScalaVersionSetting,

// necessary evil: dottydoc currently needs to be included in the dotty
// project, for sbt integration
// FIXME: note part of dottyCompilerSettings because the doc-tool does not
// compile with dotty
unmanagedResourceDirectories in Compile := Seq((resourceDirectory in Compile).value),
unmanagedResourceDirectories in Compile += baseDirectory.value / ".." / "doc-tool" / "resources",
unmanagedSourceDirectories in Compile := Seq((scalaSource in Compile).value),
unmanagedSourceDirectories in Compile += baseDirectory.value / ".." / "doc-tool" / "src",
unmanagedSourceDirectories in Test := Seq((scalaSource in Test).value),
unmanagedSourceDirectories in Test += baseDirectory.value / ".." / "doc-tool" / "test",

// Disable scaladoc generation, it's way too slow and we'll replace it
// by dottydoc anyway. We still publish an empty -javadoc.jar to make
// sonatype happy.
Expand Down