diff --git a/idea/testData/inspectionsLocal/unusedSymbol/privateProperty.kt b/idea/testData/inspectionsLocal/unusedSymbol/privateProperty.kt new file mode 100644 index 00000000000..f9a143dd3e4 --- /dev/null +++ b/idea/testData/inspectionsLocal/unusedSymbol/privateProperty.kt @@ -0,0 +1,8 @@ +// WITH_RUNTIME +// PROBLEM: Property "bar" is never used + +class Foo { + private val foo = object { + var bar: Int = 42 + } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/unusedSymbol/privateProperty.kt.after b/idea/testData/inspectionsLocal/unusedSymbol/privateProperty.kt.after new file mode 100644 index 00000000000..e4ab5653a1d --- /dev/null +++ b/idea/testData/inspectionsLocal/unusedSymbol/privateProperty.kt.after @@ -0,0 +1,8 @@ +// WITH_RUNTIME +// PROBLEM: Property "bar" is never used + +class Foo { + private val foo = object { + var bar: Int = 42 + } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/unusedSymbol/privatePropertyViaGetter.kt b/idea/testData/inspectionsLocal/unusedSymbol/privatePropertyViaGetter.kt new file mode 100644 index 00000000000..9d8ac99a711 --- /dev/null +++ b/idea/testData/inspectionsLocal/unusedSymbol/privatePropertyViaGetter.kt @@ -0,0 +1,13 @@ +// WITH_RUNTIME +// PROBLEM: none + +class Foo { + private val foo = object { + var bar: Int = 42 + } + + fun baz(): Int { + val z = foo.bar + return z + } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/unusedSymbol/privatePropertyViaSetter.kt b/idea/testData/inspectionsLocal/unusedSymbol/privatePropertyViaSetter.kt new file mode 100644 index 00000000000..b8bcbcbeda5 --- /dev/null +++ b/idea/testData/inspectionsLocal/unusedSymbol/privatePropertyViaSetter.kt @@ -0,0 +1,12 @@ +// WITH_RUNTIME +// PROBLEM: none + +class Foo { + private val foo = object { + var bar: Int = 42 + } + + fun baz(value: Int) { + foo.bar = value + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java index f9408c2aae6..5607503a3f8 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java @@ -14285,6 +14285,21 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest { runTest("idea/testData/inspectionsLocal/unusedSymbol/jsExport.kt"); } + @TestMetadata("privateProperty.kt") + public void testPrivateProperty() throws Exception { + runTest("idea/testData/inspectionsLocal/unusedSymbol/privateProperty.kt"); + } + + @TestMetadata("privatePropertyViaGetter.kt") + public void testPrivatePropertyViaGetter() throws Exception { + runTest("idea/testData/inspectionsLocal/unusedSymbol/privatePropertyViaGetter.kt"); + } + + @TestMetadata("privatePropertyViaSetter.kt") + public void testPrivatePropertyViaSetter() throws Exception { + runTest("idea/testData/inspectionsLocal/unusedSymbol/privatePropertyViaSetter.kt"); + } + @TestMetadata("propertyOfInlineClassType.kt") public void testPropertyOfInlineClassType() throws Exception { runTest("idea/testData/inspectionsLocal/unusedSymbol/propertyOfInlineClassType.kt");