Closed
Description
The following:
type M = { type T[+A] } & { type T[-A] }
val M: M = ().asInstanceOf[M]
M: M
raises:
-- [E007] Type Mismatch Error: /tmp/scastie3590197869340764976/src/main/scala/main.scala:10:2
10 | M: M
| ^
|found: Test.M(Test.M')
|required: Test.M
|
|where: M is a type in object Test which is an alias of Object{T <: ([+A] => Any)} & Object{T <: ([-A] => Any)}
| M' is a value in object Test
It also happens in the REPL without even ascribing M
:
scala> M
1 |M
|^
|Found: M(M')
|Required: M
|
|where: M is a type which is an alias of Object{T <: ([+A] => Any)} & Object{T <: ([-A] => Any)}
| M' is a value