-
Notifications
You must be signed in to change notification settings - Fork 186
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
Rewrite SAM #154
Comments
This is a cool idea! I think we will need
Should that be |
Correct, SAMs must have only one method (SAM stands for Single Abstract Method), and yes, I think the type annotation is required. |
So a plan for this could be:
I'm not sure how many edge cases we're going to cover, but it should be ok, since we would probably not generating false positives. Simply, some patterns would go unrecognized and lead to empty patches. I think this is worth a shot. |
I'm starting to work on this. #552 The spec for the SAM conversion is defined here: http://www.scala-lang.org/files/archive/spec/2.12/06-expressions.html#sam-conversion |
This is a good idea. After the PR #827, we are moving most built-in rules outside of the scalacenter/scalafix repository so that they can evolve at a different pace than Scalafix APIs. As long as a custom rule meets a certain level of quality, it can still
Ping us on Gitter if you believe your rule is good enough for inclusion. Don't hesitate to ask for help around code review or general guidance on writing/sharing custom rules. |
Does this rule exist somewhere now? |
Unfortunately not, to my knowledge. |
Thanks, I would like to have it so if I come up with something useful I will post back here 👍 |
Not sure this can be fully automated, but since Scala 2.12 has support for SAM some rewrite like this should be possible:
Given
Then this
can become (in Scala 2.12)
The text was updated successfully, but these errors were encountered: