Skip to content

DuplicateBind error triggered by same variable name in alternative pattern #1612

Closed
@ShaneDelmore

Description

@ShaneDelmore

I believe the issue is in Typer.transform. Here is an example snippet and output:

object Test {
  def g(p:(Int,Int)) = p match {
    case (10,n) | (n,10) => println(n) 
    case _ => println("nope")
  }
}

On compile this error is returned:

-- [E005] Naming Error: test.scala -------------------------------------------------------------------------------------
9 |    case (10,n) | (n,10) => println(n)
  |                   ^
  |                   duplicate pattern variable: `n`

longer explanation available when compiling with `-explain`

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions