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
Following code demonstrates an inconsistent error with Scala 2.13.1.
The code uses an implicit conversion to adapt a function to a different signature. The underscore is required only when the result of the implicit conversion is a function with a different number of parameters.
I think the error should not be given at all, or in both situations. I am not sure which of those would be more logical.
[info] Compiling 1 Scala source to W:\test\Sandbox\target\scala-2.13\classes ...
[error] W:\test\Sandbox\src\main\scala\Main.scala:15:18: missing argument list for method function2_0 in object Main
[error] Unapplied methods are only converted to functions when a function type is expected.
[error] You can make this conversion explicit by writing `function2_0 _` or `function2_0(_,_)` instead of `function2_0`.
[error] case 20 => function2_0
[error] ^
[error] W:\test\Sandbox\src\main\scala\Main.scala:16:18: missing argument list for method function2_1 in object Main
[error] Unapplied methods are only converted to functions when a function type is expected.
[error] You can make this conversion explicit by writing `function2_1 _` or `function2_1(_,_)` instead of `function2_1`.
[error] case 21 => function2_1
The text was updated successfully, but these errors were encountered:
test/files/neg/t11851.scala:20: warning: Eta-expansion performed to meet expected type (Int, Any, Int) => String, which is SAM-equivalent to <notype>,
even though trait Function3 is not annotated with `@FunctionalInterface`;
to suppress warning, add the annotation or write out the equivalent function literal.
case 20 => function2_0
^
test/files/neg/t11851.scala:21: warning: Eta-expansion performed to meet expected type (Int, Any, Int) => String, which is SAM-equivalent to <notype>,
even though trait Function3 is not annotated with `@FunctionalInterface`;
to suppress warning, add the annotation or write out the equivalent function literal.
case 21 => function2_1
^
Following code demonstrates an inconsistent error with Scala 2.13.1.
The code uses an implicit conversion to adapt a function to a different signature. The underscore is required only when the result of the implicit conversion is a function with a different number of parameters.
I think the error should not be given at all, or in both situations. I am not sure which of those would be more logical.
Compiler output:
The text was updated successfully, but these errors were encountered: