kotlin cannot auto import operator funtion such as "+" of other package

Answered

For example:

Class common.number.Number.kt:

operator fun Int.plus(other: BigInteger): BigInteger {
    return BigInteger(this.toString()).add(other)
}

Class common.test.Test.kt:

var i = 1 + BigInteger("1")

Then the Intellij Idea shows an error in class Test.kt. However, if I add the following import, the error disappears:

import common.number.Number.plus

How can I make IntelliJ Idea import this operator function automatically?

0
1 comment

Please use https://discuss.kotlinlang.org/ for any questions related to Kotlin.

0

Please sign in to leave a comment.