Skip to content

Conversation

@WojciechMazur
Copy link
Contributor

Backports #23775 to the 3.7.4.

PR submitted by the release tooling.
[skip ci]

Allow for postfix operators to be followed by assigns. This enables the definition and use of the following syntax (more precisely the parsing of the `>_=` method as a `postfix operator + assign`): ```scala val v = new Vector(1, 2, 3) println(v) // prints <1, 2, 3> v<1> = 10 // assign 10 to element at index 1 println(v) // prints <1, 10, 3> println(v<1>) // prints: value at 1 is 10 // Definition of Vector: class Vector(values: Int*) { val data = values.toArray class Getter(i: Int) { def `>_=`(x: Int) = data(i) = x def > : Int = data(i) } def < (i:Int) = new Getter(i) override def toString = data.mkString("<", ", ", ">") } ``` [Cherry-picked de18af4]
Base automatically changed from release-3.7.4_backport-23722 to release-3.7.4 September 23, 2025 09:56
@WojciechMazur WojciechMazur merged commit 24c88b2 into release-3.7.4 Sep 23, 2025
48 checks passed
@WojciechMazur WojciechMazur deleted the release-3.7.4_backport-23775 branch September 23, 2025 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants