我在package
对象中有这个方法:
def extractLoop[@specialized T](x: Map[T, T]) = {
val whatever = x.head
val stop = whatever._1
def iteration(
acc: Seq[T] = Seq(whatever._1, whatever._2),
last: T = whatever._2): Seq[T] = {
val next = x(last)
if (next == stop) acc
else iteration(acc :+ next, next)
}
iteration()
}
但我还不明白,为什么编译器(我有 2.9.2 版)说type T is unused or used in non-specializable positions.
?