Skip to content

clarify leading infix example #12970

Open
@som-snytt

Description

@som-snytt

Questions are not bug reports

Even if the bug is a head-scratcher?

Reproduction steps

Scala version: 2.13.13 vs 3.4.1

class C {
  def ??? (i: Int): Int = i+1
}
object Test extends App {
  val ??? = 6
  val c = new C
  val x =
    c
    ???
    ??? match { case i => i }

  val y =
    "hi"
    +
    "bye" match { case "bye" => "bi" case _ => "huh" }
  println(y)
  println(x)
}

Problem

As rehashed at scala/scala3#19763

x is 6 in Scala 3 where leading infix is rejected; 7 in Scala 2 which accepts it.

It would be nice to either forward-port the behavior (and specify it) or, since leading infix is now behind -Xsource-options and no one will use it, let the sleeping dog lie.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions