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 -> {
|
is KtProperty -> {
|
||||||
for (accessor in blockDeclaration.accessors) {
|
if (blockDeclaration.typeReference != null) {
|
||||||
(accessor.initializer ?: accessor.bodyExpression)
|
for (accessor in blockDeclaration.accessors) {
|
||||||
?.takeIf { it.isAncestor(element) }
|
(accessor.initializer ?: accessor.bodyExpression)
|
||||||
?.let { return it }
|
?.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);
|
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")
|
@TestMetadata("InPropertyWithFunctionLiteral.kt")
|
||||||
public void testInPropertyWithFunctionLiteral() throws Exception {
|
public void testInPropertyWithFunctionLiteral() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/outOfBlock/InPropertyWithFunctionLiteral.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/codeInsight/outOfBlock/InPropertyWithFunctionLiteral.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user