Skip to content

Pattern matching doesn't infer type equalities between singletons. #9510

Open
@sir-wabbit

Description

@sir-wabbit

Minimized code

image

sealed trait ModelNode {
  type Result
}
sealed trait RealNode {
  final type Result = Double
}

def eval(m: ModelNode): m.Result = m match {
  case m1: RealNode =>
    implicitly[m.type =:= m1.type]
    0.0
}

Expectation

Should compile. Both 0.0 : m.Result and implicitly[m.type =:= m1.type].

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions