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

Add infix operator for Scala 3 #4923

Closed
wants to merge 1 commit into from
Closed

Conversation

qwbarch
Copy link
Contributor

@qwbarch qwbarch commented Jun 12, 2021

When using Scala 3 with -source:future compiler flag enabled, the compiler complains about a missing infix operator.

For example:

val authedRoutes: AuthedRoutes[User, IO] =
  AuthedRoutes.of {
    case GET -> Root / "welcome" as user => Ok(s"Welcome, ${user.name}")
  }

The compiler will complain:

Alphanumeric extractor as is not declared `infix`; it should not be used as infix operator.
The operation can be rewritten automatically to `as` under -deprecation -rewrite.
Or rewrite to prefix syntax as(...) manually.

This PR simply adds infix for the unapply method of as for Scala 3, while keeping the exact same source code for Scala 2.

@rossabaker
Copy link
Member

👍 I didn't know about this rule. I think it's relevant back to 0.22. I'll cherry-pick it.

@rossabaker rossabaker added enhancement Feature requests and improvements module:dsl labels Jun 14, 2021
rossabaker pushed a commit that referenced this pull request Jun 14, 2021
@rossabaker rossabaker closed this Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests and improvements module:dsl
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants