2

The following code is compiling just fine with nsc:

trait A {
  type B[+T]
  type C[+T] <: B[T]
  def c: C[Int]
}

object Q {
  val a: A = ???
  val b: a.B[Int] = a.c
}

but intellij doesn't accept it with the error message

expression of type Q.a.C[Int] doesn't conform to expected type Q.a.B[Int]

Why is this the case? Is it defined somewhere what subset of Scala is allowed in IntelliJ?

Fabian Schmitthenner
  • 1,696
  • 10
  • 22

0 Answers0