Skip to content

PatMat & exhastivity spec OrTypes #1354

Closed
@DarkDimius

Description

@DarkDimius

How should this compile? Is the pattern exhaustive? Does it have unreachable cases?

object A {
  def foo(a: Int | Double) = a match {case a: (Float | Boolean) => 1}
  def fooUnsafe(a: Int | Double) = a.isInstanceOf[ Float | Boolean] // is it true or false?
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions