From 1dbf6a3feb25129664e17baf3799d07a2e9d886d Mon Sep 17 00:00:00 2001 From: Dmitry Petrashko Date: Mon, 13 Mar 2017 14:12:01 +0100 Subject: [PATCH 1/3] Fix #2084. --- .../tools/dotc/transform/TypeTestsCasts.scala | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala b/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala index 3774127fad8f..a2119bfe49dd 100644 --- a/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala +++ b/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala @@ -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 From abc5713704e24bd6896bd62c6a1f9e51b02b975a Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Sat, 11 Mar 2017 16:18:38 +0100 Subject: [PATCH 2/3] Super Bootstrap: Make dottydoc part of the bootstrap This wasn't done before because dotty could not compile dottydoc, this is now fixed. --- project/Build.scala | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/project/Build.scala b/project/Build.scala index 376e06bb18a8..5a21b7653acd 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -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), @@ -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. From d70634472036fd3b845ce10c5de61a2fb296a504 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Thu, 16 Mar 2017 21:17:50 +0100 Subject: [PATCH 3/3] doc-tool/test: Workaround #2112 --- doc-tool/test/JavaConverterTest.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc-tool/test/JavaConverterTest.scala b/doc-tool/test/JavaConverterTest.scala index 79730215c1cc..f9046a8918d0 100644 --- a/doc-tool/test/JavaConverterTest.scala +++ b/doc-tool/test/JavaConverterTest.scala @@ -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)