eenriquelopez
10/16/2020, 9:36 AMval title: (locale: Locale) -> String? = {
getPrompt(it.language)
}
fun getPrompt(string: String) : String? {
return if (string == "A") null
else "A"
}
getPrompt
can return null, hence the String?
However, the following check returns a warning from the compiler ("the comparation can be simplified since title is never null")
if (title == null) {
}
But title can effectively be null.
Is this a bug on AS/JetBrains?spand
10/16/2020, 9:37 AMeenriquelopez
10/16/2020, 9:37 AMspand
10/16/2020, 9:37 AMif (title() == null){
}
Andrea Giuliano
10/16/2020, 9:37 AMeenriquelopez
10/16/2020, 9:38 AMeenriquelopez
10/16/2020, 9:40 AMkqr
10/16/2020, 12:00 PM