From ced7f5512528cee2aa6edfb513ffc64cfbf65111 Mon Sep 17 00:00:00 2001 From: Jamie Thompson Date: Thu, 17 Nov 2022 11:51:17 +0100 Subject: [PATCH] move scala 2 test to sbt-test --- .../scala2-compat/i16351/app}/App.scala | 0 sbt-test/scala2-compat/i16351/build.sbt | 13 +++++++++++++ .../scala2-compat/i16351/lib}/lib.scala | 0 sbt-test/scala2-compat/i16351/test | 1 + tests/init/pos/i9795/A.scala | 7 +++++++ 5 files changed, 21 insertions(+) rename {tests/pos/i16351 => sbt-test/scala2-compat/i16351/app}/App.scala (100%) create mode 100644 sbt-test/scala2-compat/i16351/build.sbt rename {tests/pos/i16351 => sbt-test/scala2-compat/i16351/lib}/lib.scala (100%) create mode 100644 sbt-test/scala2-compat/i16351/test create mode 100644 tests/init/pos/i9795/A.scala diff --git a/tests/pos/i16351/App.scala b/sbt-test/scala2-compat/i16351/app/App.scala similarity index 100% rename from tests/pos/i16351/App.scala rename to sbt-test/scala2-compat/i16351/app/App.scala diff --git a/sbt-test/scala2-compat/i16351/build.sbt b/sbt-test/scala2-compat/i16351/build.sbt new file mode 100644 index 000000000000..433a5e8baddf --- /dev/null +++ b/sbt-test/scala2-compat/i16351/build.sbt @@ -0,0 +1,13 @@ +val scala3Version = sys.props("plugin.scalaVersion") +val scala2Version = sys.props("plugin.scala2Version") + +lazy val lib = project.in(file("lib")) + .settings( + scalaVersion := scala2Version + ) + +lazy val app = project.in(file("app")) + .dependsOn(lib) + .settings( + scalaVersion := scala3Version + ) diff --git a/tests/pos/i16351/lib.scala b/sbt-test/scala2-compat/i16351/lib/lib.scala similarity index 100% rename from tests/pos/i16351/lib.scala rename to sbt-test/scala2-compat/i16351/lib/lib.scala diff --git a/sbt-test/scala2-compat/i16351/test b/sbt-test/scala2-compat/i16351/test new file mode 100644 index 000000000000..19aca297fdcf --- /dev/null +++ b/sbt-test/scala2-compat/i16351/test @@ -0,0 +1 @@ +> app/compile diff --git a/tests/init/pos/i9795/A.scala b/tests/init/pos/i9795/A.scala new file mode 100644 index 000000000000..33c13b2eb592 --- /dev/null +++ b/tests/init/pos/i9795/A.scala @@ -0,0 +1,7 @@ +class A: + // Safe initialization check only allows capturing `this` either through primary constructor or synthetic `apply` + // `Some` case class comes from Scala 2 stdlib, which is not visible, hence the warning + // For reference: + // https://github.com/lampepfl/dotty/pull/12711 + // https://github.com/lampepfl/dotty/pull/14283 + val some = Some(this)