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
value foo is not a member of sample.A.
An extension method was tried, but could not be fully constructed:
sample.foo() failed with
value foo: <overloaded sample.foo> does not take parameters
In these two cases, if the dot selection is used for the function application, the codes pass the compilation.
Output
N/A
Expectation
Is it a bug of the Scala 3 compiler, or is there any syntax limition with the infix modifier?
The text was updated successfully, but these errors were encountered:
It's because infix defs don't take varargs. If foo is declared infix then
a foo (1, 2)
is treated as
a foo ((1, 2))
An infix def is a binary operator, so varargs don't make sense. There is a special case to keep the old behavior but that only kicks in if the method is not overloaded.
I don't think it's worth fixing anything here compiler-side, except accelerating the transition to the new behavior where we reject infix defs with varargs whether they are overloaded or not.
Compiler version
3.2.0
Minimized code
Change the code in #12133, add 'infix'. it works. but if the extension clause has more than one method defintion, it fails the compilation.
The error message is
if I moved all methods in A to the extension clause, that is
the messages changed to
In these two cases, if the dot selection is used for the function application, the codes pass the compilation.
Output
N/A
Expectation
Is it a bug of the Scala 3 compiler, or is there any syntax limition with the infix modifier?
The text was updated successfully, but these errors were encountered: