Skip to content

support xs @ _* and _* in Scala2 mode #1179

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

Merged
merged 1 commit into from
Mar 18, 2016
Merged

support xs @ _* and _* in Scala2 mode #1179

merged 1 commit into from
Mar 18, 2016

Conversation

liufengyun
Copy link
Contributor

Fix #1059

The standard syntax in Dotty now is xs : _*. In Scala2 mode,
following code should be valid:

list match {
  case List(_, _, _, _ @ _*)     =>   0
  case List(_, _, _*)            =>   1
  case List(_, _: _*)            =>   2
  case Nil                       =>   3
}

@@ -1282,6 +1287,12 @@ object Parsers {

/* -------- PATTERNS ------------------------------------------- */

def scala2WildcardStarMessage1 =
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd refactor a little bit differently.

  1. Introduce a method

    def migrationWarningOrError(msg: String, pos: Int) = ...
    
  2. Drop the message defs here

@odersky
Copy link
Contributor

odersky commented Mar 18, 2016

Otherwise LGTM

The standard syntax in Dotty now is `xs : _*`. In Scala2 mode,
following code should be valid:

    list match {
      case List(_, _, _, _ @ _*)     =>   0
      case List(_, _, _*)            =>   1
      case List(_, _: _*)            =>   2
      case Nil                       =>   3
    }
@liufengyun
Copy link
Contributor Author

Now I've refined the PR.

@odersky
Copy link
Contributor

odersky commented Mar 18, 2016

LGTM

odersky added a commit that referenced this pull request Mar 18, 2016
support `xs @ _*` and `_*` in Scala2 mode
@odersky odersky merged commit 1b29119 into scala:master Mar 18, 2016
@liufengyun liufengyun deleted the fix-issue-1059 branch April 6, 2016 07:59
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.

3 participants