Skip to content

UnapplySeq not fully supported #1048

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
DarkDimius opened this issue Jan 28, 2016 · 3 comments
Closed

UnapplySeq not fully supported #1048

DarkDimius opened this issue Jan 28, 2016 · 3 comments

Comments

@DarkDimius
Copy link
Contributor

Minimized from https://github.com/scala-ide/scalariform/blob/master/scalariform/src/main/scala/scalariform/astselect/AstSelector.scala#L182-L188

 def isSelectableAst(nodeStack: List[Any]) =
    nodeStack match {
      case List(_: Int, _: Double, _*) ⇒ 1
      case List(_: Int, _: Int, _*)    ⇒ 2
      case List(node, _*)              ⇒ 3
      case Nil                         ⇒ 4
    }
@DarkDimius
Copy link
Contributor Author

error: illegal start of simple pattern
  case List(_: Int, _: Double, _*) ⇒ 1
                                 ^

DarkDimius added a commit to DarkDimius/scalariform that referenced this issue Jan 28, 2016
@odersky
Copy link
Contributor

odersky commented Feb 4, 2016

The syntax for varargs patterns is now the same as for varargs arguments:

xs: _*

Can you try with this one?

@DarkDimius
Copy link
Contributor Author

def isSelectableAst(nodeStack: List[Any]) =
    nodeStack match {
      case List(_: Int, _: Double, _: _*) ⇒ 1
      case List(_: Int, _: Int, _: _*)    ⇒ 2
      case List(node, _: _*)              ⇒ 3
      case Nil                         ⇒ 4
    }

does work, but _ : _* looks ugly.

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

No branches or pull requests

2 participants