Skip to content

Case companions no longer extend FunctionN under -Xsource:3-cross, breaking binary compatibility #12961

@lrytz

Description

@lrytz

2.13.13 aligned synthetic case companions with Scala 3 to no longer extend FunctionN under -Xsource:3-cross (scala/scala#10648).

Projects that already have cross-published releases for Scala 2.13 and 3.x cannot adopt -Xsource:3-cross because this change is not binary compatible.

The workaround of manually writing out object C extends FunctionN is not a solution because that source change would also affect Scala 3, causing a binary incompatibility there. (It would also be very tedious.)

This situation can be a blocker for libraries to upgrade to Scala 2.13.13. Example:

  • On 2.13.12 with -Xsource:3 -Xmigration, the escape inraw"\u0042" is not processed
  • In 2.13.13 all semantic changes are moved to -Xsource:3-cross. A project using -Xsource:3 needs to move to -Xsource:3-cross to maintain semantics. With -Xsource:3, the escape is now being processed.
  • The binary incompatibility of case companions comes in the way.

A more general question is how do we add further language changes to -Xsource:3-cross in the future. Every semantic change comes with a warning under -Xsource:3. But projects that are already on 3-cross would silently get new semantics in a new Scala version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions