I have following implicit conversions defined, which helps me porting some Javascript code to Scala:
case class NullableBoolean(value: Boolean)
implicit def toNullable(boolean: Boolean) = NullableBoolean(boolean)
implicit def toBoolean(boolean: NullableBoolean) = boolean != null && boolean.value
The code is then used like this:
class SomeClass {
var x: NullableBoolean = _
def set(v: Boolean): Unit = {
x = v
}
def someOtherFunction(): Unit = {
if (x) println("Yes")
else print("No")
}
}
val some = new SomeClass
some.someOtherFunction()
some.set(true)
some.someOtherFunction()
When used in a small sample everything works fine. However when used in the real project, I get error:
Error:(360, 16) type mismatch;
found : xxx.NullableBoolean
required: Boolean
if (this.someValue) {
I suspect this is because of some other implicit conversion imported which makes the conversion ambiguous, but I am unable to find it. Is there some method or tool which would show me the eligible conversions or otherwise help me determining the ambiguity? I have tried IntelliJ Shift-Ctrl-Q, but it shows me only my conversion to Boolean and some conversions to String, which looks fine.