diff --git a/idea/src/org/jetbrains/kotlin/idea/slicer/OutflowSlicer.kt b/idea/src/org/jetbrains/kotlin/idea/slicer/OutflowSlicer.kt index 5fb8c6fe76a..4e766b9fe7c 100644 --- a/idea/src/org/jetbrains/kotlin/idea/slicer/OutflowSlicer.kt +++ b/idea/src/org/jetbrains/kotlin/idea/slicer/OutflowSlicer.kt @@ -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() diff --git a/idea/testData/slicer/outflow/dataClassCopy.results.txt b/idea/testData/slicer/outflow/dataClassCopy.results.txt index f07e939bef6..671b7660462 100644 --- a/idea/testData/slicer/outflow/dataClassCopy.results.txt +++ b/idea/testData/slicer/outflow/dataClassCopy.results.txt @@ -3,4 +3,3 @@ 3 data class DataClass(val value1: Int, val value2: Int) (in DataClass) 6 val v = dataClass.value1 (in foo(DataClass)) 6 val v = dataClass.value1 (in foo(DataClass)) -10 foo(dataClass.copy(value1 = value)) (in bar(Int, DataClass)) diff --git a/idea/testData/slicer/outflow/namedArgumentForConstructorParameter.kt b/idea/testData/slicer/outflow/namedArgumentForConstructorParameter.kt new file mode 100644 index 00000000000..6583c0ff503 --- /dev/null +++ b/idea/testData/slicer/outflow/namedArgumentForConstructorParameter.kt @@ -0,0 +1,6 @@ +// FLOW: OUT + +class C(val v: Int) + +fun foo() = C(v = 1) + diff --git a/idea/testData/slicer/outflow/namedArgumentForConstructorParameter.results.txt b/idea/testData/slicer/outflow/namedArgumentForConstructorParameter.results.txt new file mode 100644 index 00000000000..b4a20b30b26 --- /dev/null +++ b/idea/testData/slicer/outflow/namedArgumentForConstructorParameter.results.txt @@ -0,0 +1 @@ +3 class C(val v: Int) (in C) diff --git a/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTreeTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTreeTestGenerated.java index 038d52a31d0..e27e1f28ac9 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTreeTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTreeTestGenerated.java @@ -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");