Wrong unused import for implicit conversion

Using IDEA 10 with Scala 0.4.345, it tells that import is unused in the following code:

class Vect(val x: Double, val y: Double)


class Coef(val d: Double) {
  def *(v: Vect) = new Vect(d * v.x, d * v.y)
}


object Coef {
  implicit def doubleToCoef(d: Double) = new Coef(d)
}


object Test extends Application {
  import Coef.doubleToCoef
  val v1 = new Vect(1, 0)
  val v2 = 2 * v1
}


but after removing this import code is not compiled.
0
2 comments
Avatar
Permanently deleted user

By the way changing to

val v2 = 2.0 * v1

makes import as used.

0

I added an issue http://youtrack.jetbrains.net/issue/SCL-2616?projectKey=SCL
You can also use 2d or 2: Double instead of just 2. Or you can add overloaded method for Int. Currently this is plugin problems for converting Int with Double convention, so import problem is just corollary.

Best regards,
Alexander Podkhalyuzin.

0

Please sign in to leave a comment.