Skip to content

Some[(A, Seq[B])] is not a valid result type of an unapplySeq #3248

Closed
@allanrenucci

Description

@allanrenucci

This code snippet fails to compile with Dotty

class Test {
  class Foo(val name: String, val children: Int *)
  object Foo {
    def unapplySeq(f: Foo) = Some((f.name, f.children))
  }

  def foo(f: Foo) = f match {
    case Foo(name, ns @ _*) => 1
  }
}
[info] Running dotty.tools.dotc.Main -d out -language:Scala2 tests/allan/Test.scala -classpath dotty-library_2.12-0.4.0-bin-SNAPSHOT-nonbootstrapped.jar
-- Error: tests/allan/Test.scala:8:12 ------------------------------------------
8 |    case Foo(name, ns: _*) => 1
  |         ^^^^^^^^^^^^^^^^^
  |Some[(String, scala.collection.Seq[Int] @Repeated)] is not a valid result type of an unapplySeq method of an extractor

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions