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

Consider inferring return types of case class constructors #440

Open
illicitonion opened this issue Jun 13, 2019 · 0 comments
Open

Consider inferring return types of case class constructors #440

illicitonion opened this issue Jun 13, 2019 · 0 comments
Labels

Comments

@illicitonion
Copy link
Collaborator

In this code:

case class Foo(s: String) {}

object Lib {
  def h1 = Foo("Hello")

  val h2 = Foo("World")
}

it's kind of verbose/repetitive to require def h1: Foo = Foo("Hello").

That said, if Foo stops being a case class, needing to update call sites is kind of annoying.

Maybe we should also allow inferring generally constructor or apply calls where the public return type of the apply is the same as the name of the type...

@wiwa wiwa added the Language label Jun 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants