Skip to content

case class companion object missing toString #9161

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
antognini opened this issue Jun 11, 2020 · 1 comment · Fixed by #9165
Closed

case class companion object missing toString #9161

antognini opened this issue Jun 11, 2020 · 1 comment · Fixed by #9165

Comments

@antognini
Copy link

// 2.13.2
scala> final case class T(i:Int)
class T

scala> T
val res0: T.type = T

scala> s"I think $T is an important class"
val res1: String = I think T is an important class

// 0.24.0-RC1
scala> final case class T(i:Int)
// defined case class T

scala> T
val res0: T.type = <function1>

// add a possibly missing toString in the companion case object.
@nicolasstucki
Copy link
Contributor

Indeed, we do not generate the toString of the companion

  final case class T(i: Int) extends Object(), _root_.scala.Product, _root_.
    scala
  .Serializable {
    val i: Int
    def copy(i: Int): foo.T = new foo.T(i)
    def copy$default$1: Int = T.this.i:(T.this.i : Int) @uncheckedVariance
    def _1: Int = this.i
  }
  final lazy module val T: foo.T$ = new foo.T$()
  final module class T$() extends Object(), Function1[Int, foo.T], _root_.scala.
    Serializable
   { this: foo.T.type =>
    def apply(i: Int): foo.T = new foo.T(i)
    def unapply(x$1: foo.T): foo.T = x$1
  }

@nicolasstucki nicolasstucki changed the title case class companion object toString behaviour [2.x compat] case class companion object missing toString Jun 11, 2020
@nicolasstucki nicolasstucki self-assigned this Jun 11, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jun 11, 2020
@nicolasstucki nicolasstucki linked a pull request Jun 11, 2020 that will close this issue
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jun 11, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jun 11, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jun 24, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Aug 20, 2020
nicolasstucki added a commit that referenced this issue Aug 21, 2020
Fix #9161: Add toString to companion modules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants