KT-15846 'Change lambda expression return type' quick fix does nothing (#3182)
* Change parameter type quickfix: fix it works correctly on property delegate #KT-15846 Fixed * Change parameter type quickfix: fix it works correctly when function literal has trailing comments #KT-15846 Fixed
This commit is contained in:
committed by
GitHub
parent
5ab05e6e47
commit
957a927790
@@ -167,7 +167,14 @@ public class QuickFixUtil {
|
||||
public static boolean canFunctionOrGetterReturnExpression(@NotNull KtDeclaration functionOrGetter, @NotNull KtExpression expression) {
|
||||
if (functionOrGetter instanceof KtFunctionLiteral) {
|
||||
KtBlockExpression functionLiteralBody = ((KtFunctionLiteral) functionOrGetter).getBodyExpression();
|
||||
PsiElement returnedElement = functionLiteralBody == null ? null : functionLiteralBody.getLastChild();
|
||||
PsiElement returnedElement = null;
|
||||
if (functionLiteralBody != null) {
|
||||
PsiElement[] children = functionLiteralBody.getChildren();
|
||||
int length = children.length;
|
||||
if (length > 0) {
|
||||
returnedElement = children[length - 1];
|
||||
}
|
||||
}
|
||||
return returnedElement instanceof KtExpression && canEvaluateTo((KtExpression) returnedElement, expression);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user