Problem proving type equality when using match types in type functions

42 views Asked by At

Given

type Bool
type True <: Bool
type False <: Bool

And

type Neg [B <: Bool] <: Bool =
  B match
    case True => False
    case False => True

This compiles (no surprises here):

summon [Neg [True] =:= False]

But this, surprisingly, does not:

summon [Neg [False] =:= True]

It seems to depend on order of cases in type match - if I change the order of branches in Neg, Neg [False] will work, but Neg [True] won't?!

Scala 3.0.0-RC3

EDIT:

This works as expected (with Neg unchanged):

trait Bool
class True extends Bool
class False extends Bool

This too:

trait Bool
object True extends Bool
object False extends Bool
type True = True.type
type False = False.type
0

There are 0 answers