1

IntelliJ with the "explain types" compiler option enabled emits the following error message:

Warning: scala <:<[Array[Z],Array[Z]] <: Array[Z] => scala.collection.GenTraversableOnce[?]?
Warning:
Warning: scala: false

I suspected that IntelliJ was mangling scalac output, so I ran the compiler manually with the flag -explaintypes:

<:<[Array[Z],Array[Z]] <: Array[Z] => scala.collection.GenTraversableOnce[?]?
false
Nothing <: A?
true
A <: AnyRef?
false
a.type <: Array[T]?
false
Nothing <: A?
true
A <: AnyRef?
false
a.type <: Array[T]?
false

NOTE: I've replaced the real type name above with Z, since it is quite long, and I suspect that it is not relevant.

Sadly, neither message explains much to me. Can someone explain how to interpret these messages, ideally with pointers to documentation? Googling for scalac explaintypes primarily returns message threads about people complaining that they don't understand the output.

Dan Barowy
  • 2,270
  • 24
  • 35
  • It says that type (Array[Z] <:< Array[Z]) is not a subtype of Func[Array[Z], GenTraversableOnce[whatever]). (A <:< B), defined in Predef, is a subtype of Func[A,B]. But Array, coming from the JVM, is not a subtype of GenTraversableOnce, so Array[Z] <:< Array[Z] is not a subtype of (Array[Z] => GenTraversableOnce[Z or anything else]). Now, it is hard to tell why the compiler would tell you that without looking at your code. Probably trying and failing to fill some implicit argument. – Didier Dupont Jan 05 '14 at 23:21
  • @DidierDupont: I was able to find `<:<` defined in `Predef`, but it offers the very terse description "An instance of `A <:< B` witnesses that `A` is a subtype of `B`", which doesn't help. Is there a reference for this somewhere? Unfortunately, `<:<` resists my attempts to Google for it. – Dan Barowy Jan 07 '14 at 14:11
  • search it in the stack overflow search bar, you will get quite a few things. – Didier Dupont Jan 07 '14 at 21:58

0 Answers0