Skip to content

Make all match types invariant #6047

Closed
Closed
@OlivierBlanvillain

Description

@OlivierBlanvillain

Covariant match types should be removed as they can lead to contractions. For example:

type Id[+X] = X match {
  case Int => Int
  case String => String
}
  • Int & String <: String
  • Id[Int & String] reduces to Int, Id[String] reduces to String
  • By covariance of Id we can deduce that Int <: String, which is wrong.

Metadata

Metadata

Assignees

No one assigned

    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