Giovanni Azua Giovanni Azua - 2 months ago 8
Scala Question

How to get rid of the "non-variable type argument Type in type pattern (Type, Type) is unchecked since it is eliminated by erasure"?

I'm working in a project that uses Scala 2.10 and I have this code that uses an expanded or annonymous function e.g.

multiTest("Tarn to Mc", fixture1) {
case (capRaw: (Double, Int), /* .. more arguments .. */ callPut: Tuple2[Double, Double]) =>
// test body implementation
}


for both cases above I get the warning:

non-variable type argument Double in type pattern (Double, Int) is unchecked since it is eliminated by erasure


How can I get rid of this warning without having to define my own class UDTs?

Answer

Try:

multiTest("Tarn to Mc", fixture1) {
   case ((d: Double, i: Int), /* .. more arguments .. */ callPut: Tuple2[Double, Double]) =>
   // test body implementation
}

This might remove the compilation warning.

Comments