Skip to content

Do not rewrite { (a: Int) => ... } to { a: Int => ... } #488

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
wants to merge 1 commit into from

Conversation

smarter
Copy link
Contributor

@smarter smarter commented Nov 4, 2019

The latter syntax is removed from Dotty due to its irregularity:

scala> def foo : Int => Int = { a: Int => a }
1 |def foo : Int => Int = { a: Int => a }
  |                         ^^^^^^
  |parentheses are required around the parameter of a lambda
  |This construct can be rewritten automatically under -language:Scala2 -rewrite.

The latter syntax is removed from Dotty due to its irregularity:

scala> def foo : Int => Int = { a: Int => a }
1 |def foo : Int => Int = { a: Int => a }
  |                         ^^^^^^
  |parentheses are required around the parameter of a lambda
  |This construct can be rewritten automatically under -language:Scala2 -rewrite.
@niktrop
Copy link
Contributor

niktrop commented Nov 13, 2019

@smarter Thank you for the contribution, it will be included in the coming 2019.3 release. Please sign our contributor license agreement: https://www.jetbrains.com/agreements/cla/

I also created a ticket for the actual fix of deprecated syntax:
https://youtrack.jetbrains.com/issue/SCL-16540

@niktrop niktrop closed this Nov 13, 2019
@neko-kai
Copy link
Contributor

@niktrop @smarter
This is a dotty-only change that hasn't went through a SIP yet and may well be reverted. I'd prefer to have an option to ignore the deprecation/rewrite.

@dwijnand
Copy link
Contributor

You mean keep the rewrite? The deprecation you'll only see if you compile it with Dotty, so not a intellij-scala change.

@niktrop
Copy link
Contributor

niktrop commented Nov 14, 2019

@neko-kai
Right now only warning for syntax with parentheses is removed. If we'll add an inspection for deprecated syntax without parentheses, it will be configurable.

@neko-kai
Copy link
Contributor

@niktrop Got it, thank you! 👍
@dwijnand Yeah, that's what I mean

@SrTobi
Copy link
Contributor

SrTobi commented Dec 12, 2019

I created the inspection for SCL-16540 and turned it off by default for now. Is there an official link/github-issue for this change in dotty so I can put that into the Description of the inspection?

@smarter
Copy link
Contributor Author

smarter commented Dec 12, 2019

Is there an official link/github-issue for this change in dotty so I can put that into the Description of the inspection?

PR is scala/scala3#7156, it looks like we don't have a documentation page for that change currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants