getDataFlowAwareTypes
fun KtExpression.getDataFlowAwareTypes(bindingContext: BindingContext, languageVersionSettings: LanguageVersionSettings, dataFlowValueFactory: DataFlowValueFactory, originalType: KotlinType? = bindingContext.getType(this)): Set<KotlinType>
Returns types considering data flow.
For Example, for s
in print(s)
below, BindingContext.getType returns String?, but this function returns String.
fun foo(s: String?) {
if (s != null) {
println(s) // s is String (smart cast from String?)
}
}
Content copied to clipboard