Is this a bug in the overload resolution: ``` @Opt...
# getting-started
d
Is this a bug in the overload resolution:
Copy code
@OptIn(ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
fun foo(bar: () -> String): String {
    return bar()
}

fun foo(bar: () -> String?): String? {
    return bar()
}

fun main() {
    val present: String = "Hello"
    val missing: String? = null
    val a = foo { present } // Works
    val b = foo { missing } // Return type mismatch: expected 'String', actual 'String?'
}
I would expect
a
to be a
String
, and
b
to be a
String?
, but instead it just doesn't compile.