Skip to content

Project compiles both with Scala 3 and Scala 2, but not with -Xsource:3-cross #12975

Closed as not planned
@OndrejSpanel

Description

@OndrejSpanel

Reproduction steps

Scala version: 2.13.13

scalaVersion := "2.13.13"
  • In SBT use +compile to verify project compiles fine in Scala 2.12, 2.13 and Scala 3

  • Add following option for Scala 2.13:

scalacOptions ++= {if (scalaVersion.value.startsWith("2.13")) Seq("-Xsource:3-cross") else Seq()}
  • In sbt use compile

  • notice errors:

[error] C:\Dev\ScalaSwingContrib\src\main\scala\scalaswingcontrib\tree\Tree.scala:77:43: type mismatch;
[error]  found   : info.type (with underlying type this.companion.CellInfo)
[error]  required: editor.companion.CellInfo
[error]         editor.componentFor(tree, toB(a), info)
[error]                                           ^
[error] C:\Dev\ScalaSwingContrib\src\main\scala\scalaswingcontrib\tree\Tree.scala:105:19: type mismatch;
[error]  found   : TreeEditors.this.Editor.CellInfo
[error]  required: Editor.this.companion.CellInfo
[error]           CellInfo(isSelected = selected, isExpanded = expanded, isLeaf = leaf, row = rowIndex)).peer
[error]                   ^
[error] C:\Dev\ScalaSwingContrib\src\main\scala\scalaswingcontrib\tree\Tree.scala:175:46: type mismatch;
[error]  found   : TreeRenderers.this.Renderer.CellInfo
[error]  required: Renderer.this.companion.CellInfo
[error]         componentFor(treeWrapper, a, CellInfo(isSelected=selected, isExpanded=expanded, isLeaf=leaf, row=rowIndex, hasFocus=focus)).peer
[error]                                              ^
[error] three errors found

Problem

I think it is strange and unexpected. I hoped -Xsource:3-cross will improve cross-building, not worsen it. I have similar problem in my closed source project, where I am unable to use -Xsource:3-cross because of this.

It would probably be possible to extract much more reduced repro, but I will do it only if the issue is considered interesting enough to be worth the effort.

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