Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
4.0.0
Description
For the following case, a compile warning will be issued in Scala 2.13:
Welcome to Scala 2.13.12 (OpenJDK 64-Bit Server VM, Java 17.0.8). Type in expressions for evaluation. Or try :help. scala> class Foo { | def isEmpty(): Boolean = true | def isTrue(x: Boolean): Boolean = x | } class Foo scala> val foo = new Foo val foo: Foo = Foo@7061622 scala> val ret = foo.isEmpty ^ warning: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method isEmpty, or remove the empty argument list from its definition (Java-defined methods are exempt). In Scala 3, an unapplied method like this will be eta-expanded into a function. [quickfixable] val ret: Boolean = true
But for Scala 3, it is a compile error:
Welcome to Scala 3.3.1 (17.0.8, Java OpenJDK 64-Bit Server VM). Type in expressions for evaluation. Or try :help. scala> class Foo { | def isEmpty(): Boolean = true | def isTrue(x: Boolean): Boolean = x | } // defined class Foo scala> val foo = new Foo val foo: Foo = Foo@591f6f83 scala> val ret = foo.isEmpty -- [E100] Syntax Error: -------------------------------------------------------- 1 |val ret = foo.isEmpty | ^^^^^^^^^^^ | method isEmpty in class Foo must be called with () argument | | longer explanation available when compiling with `-explain` 1 error found
Attachments
Issue Links
- links to