scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

Same function reported as missing multiple times

Open OndrejSpanel opened this issue 1 year ago • 1 comments

Compiler version

3.0.0-3.4.1-RC1

Minimized example

trait Base {
  def func(): Unit
}

class Derived extends Base {
  def func(): Unit
}

Output Error/Warning message

class Derived needs to be abstract, since:
it has 2 unimplemented members.
/** As seen from class Derived, the missing signatures are as follows.
 *  For convenience, these are usable as stub implementations.
 */
  // Members declared in Base
  def func(): Unit = ???
  
  // Members declared in Derived
  def func(): Unit = ???

class Derived extends Base {

Why this Error/Warning was not helpful

The message was unhelpful because it lists the same function twice. When using this as a stub for implementation, you need to remove it. This is esp. confusing when there are many methods to be implemented.

Suggested improvement

It could be made more helpful by listing each method overload only once. e.g.:

class Derived needs to be abstract, since:
it has 1 unimplemented member.
/** As seen from class Derived, the missing signatures are as follows.
 *  For convenience, these are usable as stub implementations.
 */
  // Members declared in Base
  def func(): Unit = ???
  
class Derived extends Base {

OndrejSpanel avatar Feb 19 '24 12:02 OndrejSpanel

This issue was picked for the Issue Spree of February 27th, 2024. @hamzaremmal, @AnotherMedo, @entangled90 and @Valentin889 will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here.

mbovel avatar Feb 25 '24 12:02 mbovel