Skip to content

Match type bounded by type with argument(s) cannot be reduced to satisfy =:= check #17149

Closed
@tribbloid

Description

@tribbloid

Pointed out by @DmytroMitin in the following post:

https://stackoverflow.com/questions/75837775/in-scala-2-or-3-is-there-a-higher-kind-argument-extractor-without-using-match-t/75842531#75842531

  type Ext[S <: Seq[_]] = S match {
    case Seq[t] => t
  }

implicitly[Ext[Seq[Int]] =:= Int] // e.scala: Cannot prove that e.Ext[Seq[Int]] =:= Int

If I change the definition of Ext as follow, the consequence will differ:

  type Ext[S] = S match {
    case Seq[t] => t
  } // success!

  type Ext[S <: Any] = S match {
    case Seq[t] => t
  } // success!

  type Ext[S <: Seq[Any]] = S match {
    case Seq[t] => t
  } // same error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions