Alphanumeric infix warning - behavior with -source future

I wrote in: @infix to unlock operator notation is, in fact, controversial! - #19 by OndrejSpanel (deleted by accident now, when trying to quote it, unable to restore):

When I have tried compiling my sources with 3.4.0 - 3.6.2 and source future, I discovered the warning is promoted to error and you can no longer silence it.

Is this intentional? If it is, is it documented somewhere? Or is it just how source future works?

Repro:

scalaVersion := "3.6.2"

name := "Sandbox"
scalacOptions ++= Seq(
  "-source", "future",
  "-Wconf:msg=Alphanumeric method .* is not declared infix:s",
)
object Main {
  extension (a: String) def concat(b: String): String = a + b
  def main(args: Array[String]): Unit = {
    println("Hello " concat "world")
  }
}

I donā€™t know about policy, but I see there is a handy table.

1 Like

Well, thatā€™s the expected behavior. ā€˜-source:featureā€™ basically means ā€˜Iā€™d like to use the bleading edge, I accept feature/syntax deprecations that might be removed at some unspecified time in the futureā€™.

If you donā€™t need it donā€™t use it. Typically you should rather aim to use exploit minor version which might keep you project source backward compatible with newer version of compiler (best effort), or the next minor version, eg.Scala 3.6 allows to specify ā€˜-source:3.7ā€™. You can also not specify it at all.

1 Like

Did you cut it instead of copying it? :joy:

If so, just edit it once more and copy it back from here. Should work, I think.

I wanted to quote. I think I pressed ā€¦ and then again at the same place, which is delete.

Unfortunately there is no edit action available now.

Thanks, source 3.7 works quite well for me - I do not intend to use it on regular basis, I just want to be confident I am ready for the next version, but without warning me about stuff which is too far away.

That said, I think perhaps Source Compatibility would deserve some maintenance, so that one does not have to hunt through discussions and github issues to get the complete picture?

I noticed that too, the Edit option goes away after a while.
Some kind of ā€œedit spam protectionā€?
Not sure what the time limit is.
Itā€™s available at least for the next few minutes after posting (because I do edit often right after posting).
There is discussion here, apparently the default is 2 months.