Skip to content

Error message for unimplemented members does not pretty print methods correctly #3623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jvican opened this issue Dec 2, 2017 · 2 comments
Closed
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:enhancement prio:low

Comments

@jvican
Copy link
Member

jvican commented Dec 2, 2017

[error] -- Error: /data/rw/code/scala/loop/rework/src/main/scala/bloop/State.sca
la:110:8
[error] 110 |  class MyRunner(msg: String) extends sbt.testing.Runner {
[error]     |        ^
[error]     |class MyRunner needs to be abstract, since:[error]     |it has 4 unimplemented members.
[error]     |/** As seen from class MyRunner, the missing signatures are as foll
ows.
[error]     | *  For convenience, these are usable as stub implementations.
[error]     | */
[error]     |  def args: (): Array[String] = ???
[error]     |  def done: (): String = ???[error]     |  def remoteArgs: (): Array[String] = ???
[error]     |  def tasks: (x$0: Array[sbt.testing.TaskDef]): Array[sbt.testing.T
ask] = ???

As you see, def args: (): Array[String] = ??? has an extra : before the parameter list.

@OlivierBlanvillain OlivierBlanvillain added area:reporting Error reporting including formatting, implicit suggestions, etc itype:enhancement prio:low labels Dec 2, 2017
odersky added a commit that referenced this issue Dec 23, 2017
Fix #3623: Special case MethodType in PlainPrinter
@drdozer
Copy link

drdozer commented Apr 1, 2019

I think I hit this today.

[error] 12 |  implied ErrMonad for Monad[Err] {
[error]    |          ^
[error]    |object creation impossible, since:
[error]    |it has 3 unimplemented members.
[error]    |/** As seen from module class ErrMonad$, the missing signatures are as follows.
[error]    | *  For convenience, these are usable as stub implementations.
[error]    | */
[error]    |  // Members declared in cats.Applicative
[error]    |  def pure: [A](x: A): ct.Err.Err[A] = ???

This definitely does not copy-paste.

@som-snytt
Copy link
Contributor

Me, too. The extra arrow for method type and the marginal VBAR both make the convenience less convenient for quick copy/paste. (And quick trials in REPL is what this is useful for. It would be nice to drop me into multiline edit with the stubs added, with no copy/paste.)

scala> class C extends Seq[String]
1 |class C extends Seq[String]
  |      ^
  |      class C needs to be abstract, since:
  |      it has 3 unimplemented members.
  |      /** As seen from class C, the missing signatures are as follows.
  |       *  For convenience, these are usable as stub implementations.
  |       */
  |        // Members declared in scala.collection.IterableOnce
  |        def iterator: => Iterator[String] = ???
  |        
  |        // Members declared in scala.collection.SeqOps
  |        def apply(i: Int): String = ???
  |        def length: => Int = ???

versus

scala> class C extends Seq[String]
             ^
       error: class C needs to be abstract.
       Missing implementations for 3 members. Stub implementations follow:
         // Members declared in scala.collection.IterableOnce
         def iterator: Iterator[String] = ???

         // Members declared in scala.collection.SeqOps
         def apply(i: Int): String = ???
         def length: Int = ???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:enhancement prio:low
Projects
None yet
Development

No branches or pull requests

4 participants