Skip to content

Converting from T to () => T #3246

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
allanrenucci opened this issue Oct 4, 2017 · 2 comments
Closed

Converting from T to () => T #3246

allanrenucci opened this issue Oct 4, 2017 · 2 comments

Comments

@allanrenucci
Copy link
Contributor

With scalac you can do

val foo = 1
val bar: () => Int = foo _

dotc reject this code snippet. Should we support it under -language:Scala2 and emit a migration warning?

@allanrenucci
Copy link
Contributor Author

In the same style, found in the community build:

class Test {
  def foo(x: => Int) = bar(x _)
  def bar(x: () => Int) = ???
}

@allanrenucci
Copy link
Contributor Author

This pattern is used all over the place in scalatest

allanrenucci added a commit to dotty-staging/scalatest that referenced this issue Oct 5, 2017
allanrenucci added a commit to dotty-staging/scalatest that referenced this issue Oct 9, 2017
cheeseng pushed a commit to cheeseng/scalatest that referenced this issue Oct 10, 2017
odersky added a commit to odersky/dotty that referenced this issue Oct 10, 2017
cheeseng pushed a commit to cheeseng/scalatest that referenced this issue Oct 11, 2017
odersky added a commit to odersky/dotty that referenced this issue Oct 24, 2017
allanrenucci pushed a commit to dotty-staging/dotty that referenced this issue Oct 29, 2017
allanrenucci added a commit that referenced this issue Nov 1, 2017
Fix #3246: Refine handling of postfix _ for non-functions
cheeseng pushed a commit to cheeseng/scalatest that referenced this issue Nov 9, 2017
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

1 participant