You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix#9132: Align with Scala 2's handling of () infix arguments
A right argument of an infix operation is kept as an empty tuuple, instead
of being desugared to an empty parameter list.
The most involved part of the change was getting decent error messages, since
it required propagating the information that an apply is an infix all the way
into application checking. Hopefully, we can profit from the change when
we drop auto-tupling, since then similar info will be needed for error
messages in more situations.
case arg :: args1 => fail(s"too many arguments for $methString", arg)
615
+
case arg :: args1 =>
616
+
valmsg= arg match
617
+
case untpd.Tuple(Nil)
618
+
if applyKind ==ApplyKind.Infix&& funType.widen.isNullaryMethod =>
619
+
i"can't supply unit value with infix notation because nullary method $methString takes no arguments; use dotted invocation instead: (...).${methRef.name}()"
|can't supply unit value with infix notation because nullary method method toByteArray: (): Array[Byte] takes no arguments; use dotted invocation instead: (...).toByteArray()
5
+
-- [E007] Type Mismatch Error: tests/neg/i2033.scala:20:35 -------------------------------------------------------------
6
+
20 | val out = new ObjectOutputStream(println) // error
0 commit comments