Skip to content

Infix call sites to non-infix methods don't warn by default, though doc claims they would in 3.1 #17429

Closed
@SethTisue

Description

@SethTisue

at https://docs.scala-lang.org/scala3/reference/changed-features/operators.html , I read:

To smooth migration to Scala 3.0, alphanumeric operators will only be deprecated from Scala 3.1 onwards, or if the -source future option is given in Dotty/Scala 3.

But it seems this planned change hasn't taken place as of 3.3.0-RC5:

Welcome to Scala 3.3.0-RC5 (17.0.7, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                    
scala> case class A(a:Int):
     |   def plus(a:A) = A(this.a+a.a)
     | println(A(1) plus A(2))
A(3)
// defined case class A

scala> :reset -source:future -deprecation
...
-- Deprecation Warning: --------------------------------------------------------
3 |println(A(1) plus A(2))
  |             ^^^^
  |Alphanumeric method plus is not declared infix; it should not be used as infix operator.
  |Instead, use method syntax .plus(...) or backticked identifier `plus`.

This was reported on Discord today.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions