Skip to content

Discrepancy in pattern matching type checking between dotty and scalac #1269

Closed
@liufengyun

Description

@liufengyun

Following code compiles in scalac, but in dotty it generates following error message:

error: Pattern type Patmat.this.module.O.LetR is neither a subtype nor a supertype of selector type Patmat.this.module.Tree
    case module.O.LetR() =>
trait Module {
  sealed abstract class Tree

  case class LetL() extends Tree

  object O {
    case class LetR() extends Tree
  }
}

class Patmat(val module: Module) {
  def patmat(tree: module.Tree) = tree match {
    case module.LetL() =>
    case module.O.LetR() =>
  }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions