Skip to content
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

Usecases in objects need bodies #8255

Closed
scabug opened this issue Feb 8, 2014 · 3 comments
Closed

Usecases in objects need bodies #8255

scabug opened this issue Feb 8, 2014 · 3 comments

Comments

@scabug
Copy link

scabug commented Feb 8, 2014

There's a spurious "warning: only classes can have declared but undefined members" when defining usecases for members in objects. It appears when typechecking a usecase definition, since objects can't have abstract methods.

Simple walkaround: Add = ??? to your usecase so it's not an abstract member anymore.

$ cat x.scala
object Thing {
  /**
   * @usecase def merge[T, List[T]](l: List[T], r: List[T]): List[(Option[T], Option[T])] 
   */
  def merge[T, List[T] <: Traversable[T]](l: List[T], r: List[T])(implicit nth: Nothing): List[(Option[T],Option[T])] = ???
}

$ scaladoc x.scala
x.scala:3: warning: only classes can have declared but undefined members
   * @usecase def merge[T, List[T]](l: List[T], r: List[T]): List[(Option[T], Option[T])] 
              ^
warning: there were 1 feature warning(s); re-run with -feature for details
model contains 2 documentable templates
two warnings found

$ diff y.scala x.scala
3c3
<    * @usecase def merge[T, List[T]](l: List[T], r: List[T]): List[(Option[T], Option[T])] = ??? 
---
>    * @usecase def merge[T, List[T]](l: List[T], r: List[T]): List[(Option[T], Option[T])] 

$ scaladoc y.scala
warning: there were 1 feature warning(s); re-run with -feature for details
model contains 2 documentable templates
one warning found
@scabug
Copy link
Author

scabug commented Feb 8, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8255?orig=1
Reporter: @VladUreche
Affected Versions: 2.10.4-RC1

@scabug
Copy link
Author

scabug commented Feb 8, 2014

Christian Krause (wookietreiber) said:
This is the most awesome workaround ever :)

@SethTisue SethTisue added this to the Backlog milestone Mar 3, 2018
@julian-zucker
Copy link

@usecase was deprecated in 2.13, can this issue be closed?

@SethTisue SethTisue modified the milestones: Backlog, 2.13.0 Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants