Skip to content

Star match with external capture fails #13844

Open
@Adam-Vandervorst

Description

@Adam-Vandervorst

Compiler version

3.1.2-RC1-bin-20211027-435207d-NIGHTLY

Minimized code

  val qs = Seq(2, 3)
  Seq(1, 2, 3) match
    case Seq(b, `qs`: _*) => println("matched")
    case Seq(b, vs: _*) => println("missed")

Output

    case Seq(b, `qs`: _*) => println("matched")
                ^^^^
                Found:    (qs : Seq[Int])
                Required: Int

Expectation

Work the same as

  val q = 2
  Seq(1, 2) match
    case Seq(b, `q`) => println("matched")
    case Seq(b, p) => println("missed")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions