Skip to content

Scala 3 / 2.13 backward compatibility #1641

Open
@rtkaczyk

Description

@rtkaczyk

I'm looking into cross building Scala 2.13 / 3.3 targets and I've been playing with the 2_deps example. When I do the following tweaks:

diff --git a/examples/crossbuild/2_deps/BUILD b/examples/crossbuild/2_deps/BUILD
index ff04ca1..135fc0f 100644
--- a/examples/crossbuild/2_deps/BUILD
+++ b/examples/crossbuild/2_deps/BUILD
@@ -13,6 +13,7 @@ scala_library(
 scala_library(
     name = "lib",
     srcs = ["lib_default.scala"],
+    scala_version = "3.3.1",
 )

 scala_binary(
diff --git a/examples/crossbuild/2_deps/bin.scala b/examples/crossbuild/2_deps/bin.scala
index f038de2..d70708c 100644
--- a/examples/crossbuild/2_deps/bin.scala
+++ b/examples/crossbuild/2_deps/bin.scala
@@ -1,3 +1,3 @@
 object C extends App {
-  println("Hello, world")
+  println("Hello, world: " + new B)
 }

then bin213 fails to build:

error: error while loading B, Missing dependency 'Add -Ytasty-reader to scalac options to parse the TASTy in bazel-out/darwin_arm64-fastbuild/bin/2_deps/lib.jar(deps/B.class)', required by bazel-out/darwin_arm64-fastbuild/bin/2_deps/lib.jar(deps/B.class)
2_deps/bin.scala:4: error: deps.B does not have a constructor
  println("Hello, world: " + new B)
                             ^

Adding -Ytasty-reader doesn't help, produces a different error:

2_deps/bin.scala:2: error: could not find package scala.annotation.internal whilst reading annotation of package <empty>; perhaps it is missing from the classpath.
  println("Hello, world: " + new B)
                                 ^

So, is 3 ← 2.13 backward compatibility not supported / broken, or am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions