Match type reduction fails with opaque type

53 Views Asked by At

Scastie available here

I am having issues using match types with opaque types as scrutinees. In the following snippet the type of b is simply not reduced (b: Match[T1[Char]] instead of b: String).

Note: everything works fine as soon as T1 is not opaque anymore

object Foo:
    type Match[A] = A match
        case Int => String
        case T1[a] => String

    opaque type T1[A] = Double
    // type T1[A] = Double


import Foo.*

val a: Match[Int] = "" 
val b: Match[T1[Char]] = ""       //doesn't compile

Is this a known issue or am I missing something ?

0

There are 0 best solutions below