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

avoid infix with _*. prepare Scala 3 #11325

Merged
merged 1 commit into from Jun 14, 2022

Conversation

xuwei-k
Copy link
Contributor

@xuwei-k xuwei-k commented Jun 13, 2022

Pull Request Checklist

Helpful things

Fixes

Purpose

fix compile error with Scala 3.

Background Context

[error] 99 |    withAttrs(attrs + (entries: _*))
[error]    |                                ^
[error]    |          `_*` can be used only for last argument of method application.
[error]    |          It is no longer allowed in operands of infix operations.
Welcome to Scala 3.1.2 (11.0.15, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> object A { def +(xs: Int*): Unit = () }
// defined object A

scala> def a(xs: Int*) = A + (xs: _*)
-- Error: ----------------------------------------------------------------------
1 |def a(xs: Int*) = A + (xs: _*)
  |                           ^
  |            `_*` can be used only for last argument of method application.
  |            It is no longer allowed in operands of infix operations.

scala> def a(xs: Int*) = A.+(xs: _*)
def a(xs: Int*): Unit

References

https://github.com/playframework/playframework/blob/6e614d11cca8070e6c3aa4940f682f8cc1183e73/core/play/src/main/scala/play/api/libs/typedmap/TypedMap.scala#L94

```
[error] 99 |    withAttrs(attrs + (entries: _*))
[error]    |                                ^
[error]    |          `_*` can be used only for last argument of method application.
[error]    |          It is no longer allowed in operands of infix operations.
```

```
Welcome to Scala 3.1.2 (11.0.15, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> object A { def +(xs: Int*): Unit = () }
// defined object A

scala> def a(xs: Int*) = A + (xs: _*)
-- Error: ----------------------------------------------------------------------
1 |def a(xs: Int*) = A + (xs: _*)
  |                           ^
  |            `_*` can be used only for last argument of method application.
  |            It is no longer allowed in operands of infix operations.

scala> def a(xs: Int*) = A.+(xs: _*)
def a(xs: Int*): Unit
```
@xuwei-k xuwei-k marked this pull request as ready for review June 13, 2022 06:15
Copy link
Member

@octonato octonato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@octonato octonato merged commit 674668e into playframework:main Jun 14, 2022
@xuwei-k xuwei-k deleted the TypedMap-withAttrs-infix branch June 14, 2022 07:15
@ihostage ihostage added this to the 2.9.0 milestone Jun 14, 2022
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.

None yet

3 participants