Data Flow from Here: do not include named argument references

This commit is contained in:
Valentin Kipyatkov
2020-04-21 16:18:22 +03:00
parent 7c81d93db0
commit 56b20b0f31
5 changed files with 14 additions and 1 deletions
@@ -103,6 +103,8 @@ class OutflowSlicer(
return
}
if (refElement.parent is KtValueArgumentName) return // named argument reference is not a read or write
val refExpression = KtPsiUtil.safeDeparenthesize(refElement)
if (withDereferences) {
refExpression.processDereferences()
@@ -3,4 +3,3 @@
3 data class DataClass(<bold>val value1: Int</bold>, val value2: Int) (in DataClass)
6 val v = dataClass.<bold>value1</bold> (in foo(DataClass))
6 <bold>val v</bold> = dataClass.value1 (in foo(DataClass))
10 foo(dataClass.copy(<bold>value1</bold> = value)) (in bar(Int, DataClass))
@@ -0,0 +1,6 @@
// FLOW: OUT
class C(val <caret>v: Int)
fun foo() = C(v = 1)
@@ -0,0 +1 @@
3 class C(<bold>val v: Int</bold>) (in C)
@@ -688,6 +688,11 @@ public class SlicerTreeTestGenerated extends AbstractSlicerTreeTest {
runTest("idea/testData/slicer/outflow/memberPropertyUsages.kt");
}
@TestMetadata("namedArgumentForConstructorParameter.kt")
public void testNamedArgumentForConstructorParameter() throws Exception {
runTest("idea/testData/slicer/outflow/namedArgumentForConstructorParameter.kt");
}
@TestMetadata("nonInlineLetResult.kt")
public void testNonInlineLetResult() throws Exception {
runTest("idea/testData/slicer/outflow/nonInlineLetResult.kt");