Closed
Description
Minimised Code
enum Bool {
case True
case False
}
import Bool._
type Not[B <: Bool] = B match {
case True.type => False.type
case False.type => True.type
}
val f: Not[False.type] = True
Output
13 |val f: Not[False.type] = True
| ^^^^
| Found: (Bool.True : Bool)
| Required: Not[(Bool.False : Bool)]
Expectation
if I replace enum Bool
with a sealed trait and case objects then the code compiles:
+sealed trait Bool
+object Bool {
+ case object True extends Bool
+ case object False extends Bool
-enum Bool {
- case True
- case False
}
...
Originally posted by @bishabosha in #10510 (comment)