Skip to content

A GADT type parameter throws off even a non-GADT one #16745

Open
@TomasMikula

Description

@TomasMikula

Compiler version

3.2.2

Minimized code

class Test[F[_]] {
  sealed trait Foo[A, B]

  // note that Foo's B param maps directly to U (i.e. no GADT involved on this type param)
  case class Bar[T, U]() extends Foo[F[T], U] {
    def get: Option[U] = None
  }
  
  def go[T, U](that: Foo[F[T], U]): Option[U] =
    that match
      case b: Bar[t, u] =>
        summon[U =:= u] // Error: Cannot prove that U =:= u.
        b.get           // Error: Found: Option[u], Required: Option[U]
}

Output

Compilation fails, see the errors in the comments.

Expectation

The code should compile.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions