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.

By the way changing to

val v2 = 2.0 * v1

makes import as used.


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.


Please sign in to leave a comment.