Closed bishabosha closed 2 years ago
This one works for the type pattern
object GADT {
import =:=._
enum =:=[A, B] {
case Refl[C]() extends (C =:= C)
}
def unwrap[A,B](opt: Option[A])(using ev: A =:= Option[B]): Option[B] = ev match {
case _: Refl[?] => opt.flatMap(identity[Option[B]])
}
}
@abgruszecki abgruszecki self-assigned this on Mar 19, 2020
@abgruszecki Did you have an angle of attack for this issue? Maybe @liufengyun could help?
I think I just assigned this issue to myself because otherwise it'd simply get lost.
another example in 3.0.1-RC1:
object Main extends App:
enum Extends[A, B]:
case Ev[B, A <: B]() extends (A Extends B)
def cast(a: A): B = this match {
case Extends.Ev() => a
}
This seems to be related to #9682. We need to rethink whether using wildApprox
is appropriate in TypeOps.instantiateToSubtype
. It also interferes with the changes we did in #8698 to support #8690.
A simplification of #6088
minimized code
error:
The warning goes away if you make
A
contravariant.expectation
No warning