E203: Deprecated Assignment Syntax

This warning occurs when using parentheses around an assignment expression like (x = value). Starting from Scala 3.7, this syntax is interpreted as a named tuple with one element rather than an assignment.

This is a migration warning to help transition code from the old assignment interpretation to the new named tuple semantics.

Example

def example() =
  var age: Int = 28
  (age = 29)

Error

-- [E203] Syntax Migration Warning: example.scala:3:2 --------------------------
3 |  (age = 29)
  |  ^^^^^^^^^^
  |Deprecated syntax: since 3.7 this is interpreted as a named tuple with one element,
  |not as an assignment.
  |
  |To assign a value, use curly braces: `{age = 29}`.
  |This can be rewritten automatically under -rewrite -source 3.6-migration.

Solution

Use curly braces instead of parentheses for assignments:

def example() =
  var age: Int = 28
  { age = 29 }

Alternatively, you can use the automatic rewrite feature by compiling with -rewrite -source 3.6-migration to automatically update the syntax.