hey guys, I'm having a problem here where when `my...
# announcements
r
hey guys, I'm having a problem here where when
myString == null
it matches both the
String?
and
Int?
types. Anyone know a way around this?
Copy code
fun hello(myString: String?, myBoolean: Boolean) {}

fun hello(myInt: Int?, myBoolean: Boolean) {}

fun hi(myString: String?) {
    if (myString == null) {
        hello(myString, false) //overload resolution ambiguity
    } else {
        hello(myString, true) // this works fine
    }
}
m
Calling
hello
with either
null as Int?
or
null as String?
should resolve the ambiguity.
r
that works, thanks!