Add regression tests to cover Unused symbol with private anonymous object property
^KT-39454 Fixed
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
+15
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user