I don’t know why the following scala code can not be compiled:
import collection.immutable.Seq
def foo(nodes: Seq[Int]) = null
val nodes:IndexedSeq[Int] = null
foo(nodes)
=>
error: type mismatch;
found : IndexedSeq[Int]
required: scala.collection.immutable.Seq[Int]
foo(nodes)
^
In scala-library, IndexedSeq is declared:
trait IndexedSeq[+A] extends Seq[A]...
There are several IndexedSeq traits. Default is
scala.collection.IndexedSeq. if youimport collection.immutable.IndexedSeqthen scala will compile successfully. (Copied from OP)