Intellij Idea kotlin不能自动导入一些运算符函数,例如+

例如:

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") 

然后,Intellij Idea在Test.kt类中显示错误。 但是,如果我添加以下导入,错误消失:

 import common.number.Number.plus 

我怎样才能让IntelliJ Idea自动导入这个操作函数?

因为做特别的扩展操作员所以需要。 它像扩展function一样工作。 需要导入,因为想法需要知道你想要使用哪个扩展名。 所以扩展可以多一个。