Add regression tests to cover Unused symbol with private anonymous object property

^KT-39454 Fixed
This commit is contained in:
Vladimir Dolzhenko
2020-09-17 11:54:18 +02:00
parent d1ba69044e
commit 985f2b839c
5 changed files with 56 additions and 0 deletions
@@ -0,0 +1,8 @@
// WITH_RUNTIME
// PROBLEM: Property "bar" is never used
class Foo {
private val foo = object {
var bar<caret>: Int = 42
}
}
@@ -0,0 +1,8 @@
// WITH_RUNTIME
// PROBLEM: Property "bar" is never used
class Foo {
private val foo = object {
var bar: Int = 42
}
}
@@ -0,0 +1,13 @@
// WITH_RUNTIME
// PROBLEM: none
class Foo {
private val foo = object {
var bar<caret>: Int = 42
}
fun baz(): Int {
val z = foo.bar
return z
}
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// PROBLEM: none
class Foo {
private val foo = object {
var bar<caret>: Int = 42
}
fun baz(value: Int) {
foo.bar = value
}
}
@@ -14285,6 +14285,21 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
runTest("idea/testData/inspectionsLocal/unusedSymbol/jsExport.kt"); 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") @TestMetadata("propertyOfInlineClassType.kt")
public void testPropertyOfInlineClassType() throws Exception { public void testPropertyOfInlineClassType() throws Exception {
runTest("idea/testData/inspectionsLocal/unusedSymbol/propertyOfInlineClassType.kt"); runTest("idea/testData/inspectionsLocal/unusedSymbol/propertyOfInlineClassType.kt");