More aggressive block cache invalidation for declarations with type inference
This commit is contained in:
@@ -35,18 +35,18 @@ public final class JetModifiableBlockHelper {
|
|||||||
if (declaration instanceof JetNamedFunction) {
|
if (declaration instanceof JetNamedFunction) {
|
||||||
JetNamedFunction function = (JetNamedFunction) declaration;
|
JetNamedFunction function = (JetNamedFunction) declaration;
|
||||||
if (function.hasDeclaredReturnType() || function.hasBlockBody()) {
|
if (function.hasDeclaredReturnType() || function.hasBlockBody()) {
|
||||||
return false;
|
return takePartInDeclarationTypeInference(function);
|
||||||
}
|
}
|
||||||
|
|
||||||
return shouldChangeModificationCount(function);
|
return shouldChangeModificationCount(function);
|
||||||
}
|
}
|
||||||
else if (declaration instanceof JetPropertyAccessor) {
|
else if (declaration instanceof JetPropertyAccessor) {
|
||||||
return false;
|
return takePartInDeclarationTypeInference(declaration);
|
||||||
}
|
}
|
||||||
else if (declaration instanceof JetProperty) {
|
else if (declaration instanceof JetProperty) {
|
||||||
JetProperty property = (JetProperty) declaration;
|
JetProperty property = (JetProperty) declaration;
|
||||||
if (property.getPropertyTypeRef() != null) {
|
if (property.getPropertyTypeRef() != null) {
|
||||||
return false;
|
return takePartInDeclarationTypeInference(property);
|
||||||
}
|
}
|
||||||
|
|
||||||
return shouldChangeModificationCount(property);
|
return shouldChangeModificationCount(property);
|
||||||
@@ -59,4 +59,26 @@ public final class JetModifiableBlockHelper {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean takePartInDeclarationTypeInference(PsiElement place) {
|
||||||
|
JetDeclaration declaration = PsiTreeUtil.getParentOfType(place, JetDeclaration.class, true);
|
||||||
|
if (declaration != null) {
|
||||||
|
if (declaration instanceof JetNamedFunction) {
|
||||||
|
JetNamedFunction function = (JetNamedFunction) declaration;
|
||||||
|
if (!function.hasDeclaredReturnType()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (declaration instanceof JetProperty) {
|
||||||
|
JetProperty property = (JetProperty) declaration;
|
||||||
|
if (property.getPropertyTypeRef() == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return takePartInDeclarationTypeInference(declaration);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// TRUE
|
||||||
|
val o = object {
|
||||||
|
fun test() {
|
||||||
|
<caret>
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -54,6 +54,10 @@ public class OutOfBlockModificationTest extends LightCodeInsightFixtureTestCase
|
|||||||
doTest();
|
doTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testInAntonymsObjectDeclaration() {
|
||||||
|
doTest();
|
||||||
|
}
|
||||||
|
|
||||||
public void testInPropertyWithFunctionLiteral() {
|
public void testInPropertyWithFunctionLiteral() {
|
||||||
doTest();
|
doTest();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user