E204: Deprecated Infix Named Argument Syntax

This warning occurs when using named arguments with infix method calls like objmethod(x = 1, y = 2). Starting from Scala 3.7, this syntax is interpreted as passing a single named tuple argument rather than multiple named arguments.

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

Example

class C:
  def combine(x: Int, y: Int): Int = x + y
  def example = new C() `combine` (x = 42, y = 27)

Error

-- [E204] Syntax Warning: example.scala:3:34 -----------------------------------
3 |  def example = new C() `combine` (x = 42, y = 27)
  |                                  ^^^^^^^^^^^^^^^^
  |Deprecated syntax: infix named arguments lists are deprecated; since 3.7 it is interpreted as a single named tuple argument.
  |To avoid this warning, either remove the argument names or use dotted selection.
  |This can be rewritten automatically under -rewrite -source 3.7-migration.

Solution

Use dotted selection instead of infix notation when using named arguments:

class C:
  def combine(x: Int, y: Int): Int = x + y
  def example = new C().combine(x = 42, y = 27)

Alternatively, remove the argument names and use positional arguments with infix notation:

class D:
  def combine(x: Int, y: Int): Int = x + y
  def example = new D() `combine` (42, 27)

You can also use the automatic rewrite feature by compiling with -rewrite -source 3.7-migration to automatically update the syntax.