diff --git a/sbt-dotty/sbt-test/scala2-compat/i8847/build.sbt b/sbt-dotty/sbt-test/scala2-compat/i8847/build.sbt new file mode 100644 index 000000000000..3f24e1d347aa --- /dev/null +++ b/sbt-dotty/sbt-test/scala2-compat/i8847/build.sbt @@ -0,0 +1,15 @@ +val scala3Version = sys.props("plugin.scalaVersion") +val scala2Version = "2.13.3" + +lazy val `i8847-lib` = (project in file ("lib")) + .settings(scalaVersion := scala2Version) + +lazy val `i8847-test` = (project in file ("main")) + .dependsOn(`i8847-lib`) + .settings( + scalaVersion := scala3Version, + // https://github.com/sbt/sbt/issues/5369 + projectDependencies := { + projectDependencies.value.map(_.withDottyCompat(scalaVersion.value)) + } + ) diff --git a/sbt-dotty/sbt-test/scala2-compat/i8847/lib/i8847-lib.scala b/sbt-dotty/sbt-test/scala2-compat/i8847/lib/i8847-lib.scala new file mode 100644 index 000000000000..15e4c942698f --- /dev/null +++ b/sbt-dotty/sbt-test/scala2-compat/i8847/lib/i8847-lib.scala @@ -0,0 +1,19 @@ +package i8847 + +trait P { + // The `private` modifier is needed, and `X` must be a case class or case object + private case class X(x: Int) + private case object Y +} + +trait Foo { + def foo(): Unit = ??? +} + +trait Bar extends Foo { + override def foo(): Unit = super.foo() +} + +trait Baz extends Foo { + override def foo(): Unit = super.foo() +} diff --git a/sbt-dotty/sbt-test/scala2-compat/i8847/main/i8847-test.scala b/sbt-dotty/sbt-test/scala2-compat/i8847/main/i8847-test.scala new file mode 100644 index 000000000000..d9f174d0216d --- /dev/null +++ b/sbt-dotty/sbt-test/scala2-compat/i8847/main/i8847-test.scala @@ -0,0 +1,5 @@ +import i8847.{P, Bar, Baz} + +class T extends P + +class C extends Bar with Baz diff --git a/sbt-dotty/sbt-test/scala2-compat/i8847/project/plugins.sbt b/sbt-dotty/sbt-test/scala2-compat/i8847/project/plugins.sbt new file mode 100644 index 000000000000..c17caab2d98c --- /dev/null +++ b/sbt-dotty/sbt-test/scala2-compat/i8847/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version")) diff --git a/sbt-dotty/sbt-test/scala2-compat/i8847/test b/sbt-dotty/sbt-test/scala2-compat/i8847/test new file mode 100644 index 000000000000..9c4db8df3207 --- /dev/null +++ b/sbt-dotty/sbt-test/scala2-compat/i8847/test @@ -0,0 +1 @@ +> i8847-test/compile