Skip to content

Typer: Incorrent assumtions when typing pattern matches #1352

Closed
@DarkDimius

Description

@DarkDimius

Typer assumes that pattern matching in only doing dowcasts and rejects this valid code. This code is accepted by scalac:

trait A
trait B

abstract sealed class Parent
class Foo extends Parent with A
class Bar extends Parent with B

(null: Parent) match {
  case (_: A) | (_: B) => // dotty complains here that neither A or B are subtypes of Parent
}

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