Scala warning erasure in case

I have the following pattern matching case in a scala function:

def someFunction(sequences: Iterable[Seq[Int]]):Seq[Int] = sequences match{
    case Seq() => Seq(1)
    case _ => ...
    ...
}

And I get the following warning:

warning: non variable type-argument A in type pattern Seq[A] is unchecked since it is eliminated by erasure
case Seq(_) => Seq(1)
        ^
one warning found

What does this mean?

Answers


This warning is a bit spurious, and will not be present on Scala 2.10. In fact, I think it's a regression from Scala 2.8 (that is, it is not present there).

The reason for the warning is that it interprets Seq(_) to mean Seq(_: Seq[Int]), since that's the type parameter of sequences, and then complaining that it can't guarantee that Int there, since, at compile time, that will be erased. As I said, it's spurious.


Need Your Help

Xcode: App crashes because I deleted a class no other class uses anymore?

ios objective-c xcode

Very strange behaviour...I've used before an NSNumber category called NSNumber+Currencies. Yesterday I've changed everything including core data to NSDecimalNumber so I have now a class NSDecimalNu...

Linux Ubuntu mono

c# linux ubuntu mono

I'm trying to install absolute small package of mono for our app, which is .net 4.0 (console app) what package should i install?