Skip to content

Sequence Pattern matcher should guard against null #2241

@scabug

Description

@scabug

When passing null into a match expression with a Sequence Pattern, a null pointer exception occurs. But shouldn't the pattern automatically guard against it? The following case illustrates the problem:

def f(a:Array[Int]) = a match {
  case Array(1, _*) => "yes"
  case _ => "no"
}

Calling f(null), I expect to get "no", but I get the null pointer exception instead.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions