Force OOB in accessors for properties without explicit type (KT-19062)
#KT-19062 Fixed
This commit is contained in:
+6
-4
@@ -89,10 +89,12 @@ class KotlinCodeBlockModificationListener(
|
||||
}
|
||||
|
||||
is KtProperty -> {
|
||||
for (accessor in blockDeclaration.accessors) {
|
||||
(accessor.initializer ?: accessor.bodyExpression)
|
||||
?.takeIf { it.isAncestor(element) }
|
||||
?.let { return it }
|
||||
if (blockDeclaration.typeReference != null) {
|
||||
for (accessor in blockDeclaration.accessors) {
|
||||
(accessor.initializer ?: accessor.bodyExpression)
|
||||
?.takeIf { it.isAncestor(element) }
|
||||
?.let { return it }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// TRUE
|
||||
|
||||
class A {
|
||||
fun foo(): Int = 12
|
||||
}
|
||||
|
||||
class B(val a: A) {
|
||||
val prop1 get() = a.fo<caret>o()
|
||||
}
|
||||
|
||||
// TODO
|
||||
// SKIP_ANALYZE_CHECK
|
||||
+6
@@ -180,6 +180,12 @@ public class OutOfBlockModificationTestGenerated extends AbstractOutOfBlockModif
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InPropertyAccessorWithInferenceInClass.kt")
|
||||
public void testInPropertyAccessorWithInferenceInClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/outOfBlock/InPropertyAccessorWithInferenceInClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InPropertyWithFunctionLiteral.kt")
|
||||
public void testInPropertyWithFunctionLiteral() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/outOfBlock/InPropertyWithFunctionLiteral.kt");
|
||||
|
||||
Reference in New Issue
Block a user