Brais Gabin
08/30/2021, 3:15 PMKtNamedFunction
) and I want to know if the returning type is Unit or not with type solving. I'm using this: function.bodyExpression.getResolvedCall(bindingContext)?.resultingDescriptor?.returnType?.isUnit()
but I get null for functions like this: fun asdf() = 5
. And if I use this: function.getType(bindingContext)?.fqNameOrNull()?.shortName()?.let { it.toString() == "Unit" }
get null
for fun asdf() {}
.gammax
08/30/2021, 5:08 PMt-kameyama
08/31/2021, 12:23 AMoverride fun visitNamedFunction(function: KtNamedFunction) {
val descriptor = bindingContext[BindingContext.DECLARATION_TO_DESCRIPTOR, function] as? FunctionDescriptor
val isUnit = descriptor?.returnType?.isUnit()
}
Brais Gabin
08/31/2021, 2:42 PM