[FIR] Update/add extended checker tests

This commit is contained in:
vldf
2020-08-27 10:46:01 +03:00
committed by Mikhail Glukhikh
parent acbb67f851
commit bf363e8f1a
43 changed files with 351 additions and 72 deletions
@@ -1,5 +1,5 @@
// WITH_RUNTIME // WITH_RUNTIME
// IS_APPLICABLE: false // IS_APPLICABLE: false
fun foo(s: String?) { fun foo(s: String?) {
val t: String = s.toString() val <!UNUSED_VARIABLE!>t<!>: String = s.toString()
} }
@@ -3,5 +3,5 @@
data class Foo(val name: String) data class Foo(val name: String)
fun nullable2(foo: Foo?) { fun nullable2(foo: Foo?) {
val s: String = foo?.name.toString() val <!UNUSED_VARIABLE!>s<!>: String = foo?.name.toString()
} }
@@ -2,5 +2,5 @@
data class Foo(val name: String) data class Foo(val name: String)
fun test(foo: Foo?) { fun test(foo: Foo?) {
val s: String? = foo?.name?.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toString()<!> val <!UNUSED_VARIABLE!>s<!>: String? = foo?.name?.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toString()<!>
} }
@@ -1,4 +1,4 @@
// WITH_RUNTIME // WITH_RUNTIME
fun test(i: UByte) { fun test(i: UByte) {
val foo = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toUByte()<!> val <!UNUSED_VARIABLE!>foo<!> = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toUByte()<!>
} }
@@ -1,4 +1,4 @@
// WITH_RUNTIME // WITH_RUNTIME
fun test(i: UInt) { fun test(i: UInt) {
val foo = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toUInt()<!> val <!UNUSED_VARIABLE!>foo<!> = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toUInt()<!>
} }
@@ -1,4 +1,4 @@
// WITH_RUNTIME // WITH_RUNTIME
fun test(i: ULong) { fun test(i: ULong) {
val foo = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toULong()<!> val <!UNUSED_VARIABLE!>foo<!> = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toULong()<!>
} }
@@ -1,4 +1,4 @@
// WITH_RUNTIME // WITH_RUNTIME
fun test(i: UShort) { fun test(i: UShort) {
val foo = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toUShort()<!> val <!UNUSED_VARIABLE!>foo<!> = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toUShort()<!>
} }
@@ -4,16 +4,16 @@ import kotlin.reflect.KClass
annotation class A annotation class A
fun annotated() { fun annotated() {
val x: @A Int /* NOT redundant */ = 1 val <!UNUSED_VARIABLE!>x<!>: @A Int /* NOT redundant */ = 1
} }
object SomeObj object SomeObj
fun fer() { fun fer() {
val x: Any /* NOT redundant */ = SomeObj val <!UNUSED_VARIABLE!>x<!>: Any /* NOT redundant */ = SomeObj
} }
fun f2(y: String?): String { fun f2(y: String?): String {
val f: KClass<*> = (y ?: return "")::class val <!UNUSED_VARIABLE!>f<!>: KClass<*> = (y ?: return "")::class
return "" return ""
} }
@@ -25,7 +25,7 @@ interface IB : IA
fun IA.extFun(x: IB) {} fun IA.extFun(x: IB) {}
fun testWithExpectedType() { fun testWithExpectedType() {
val extFun_AB_A: IA.(IB) -> Unit = IA::extFun val <!UNUSED_VARIABLE!>extFun_AB_A<!>: IA.(IB) -> Unit = IA::extFun
} }
interface Point { interface Point {
@@ -36,27 +36,27 @@ interface Point {
class PointImpl(override val x: Int, override val y: Int) : Point class PointImpl(override val x: Int, override val y: Int) : Point
fun foo() { fun foo() {
val s: <!REDUNDANT_EXPLICIT_TYPE!>String<!> = "Hello ${10+1}" val <!UNUSED_VARIABLE!>s<!>: <!REDUNDANT_EXPLICIT_TYPE!>String<!> = "Hello ${10+1}"
val str: String? = "" val <!UNUSED_VARIABLE!>str<!>: String? = ""
val o: <!REDUNDANT_EXPLICIT_TYPE!>Obj<!> = Obj val <!UNUSED_VARIABLE!>o<!>: <!REDUNDANT_EXPLICIT_TYPE!>Obj<!> = Obj
val p: Point = PointImpl(1, 2) val <!UNUSED_VARIABLE!>p<!>: Point = PointImpl(1, 2)
val a: <!REDUNDANT_EXPLICIT_TYPE!>Boolean<!> = true val <!UNUSED_VARIABLE!>a<!>: <!REDUNDANT_EXPLICIT_TYPE!>Boolean<!> = true
val i: Int = 2 * 2 val <!UNUSED_VARIABLE!>i<!>: Int = 2 * 2
val l: <!REDUNDANT_EXPLICIT_TYPE!>Long<!> = 1234567890123L val <!UNUSED_VARIABLE!>l<!>: <!REDUNDANT_EXPLICIT_TYPE!>Long<!> = 1234567890123L
val s: String? = null val <!UNUSED_VARIABLE!>s<!>: String? = null
val sh: Short = 42 val <!UNUSED_VARIABLE!>sh<!>: Short = 42
val integer: <!REDUNDANT_EXPLICIT_TYPE!>Int<!> = 42 val <!UNUSED_VARIABLE!>integer<!>: <!REDUNDANT_EXPLICIT_TYPE!>Int<!> = 42
val piFloat: <!REDUNDANT_EXPLICIT_TYPE!>Float<!> = 3.14f val <!UNUSED_VARIABLE!>piFloat<!>: <!REDUNDANT_EXPLICIT_TYPE!>Float<!> = 3.14f
val piDouble: <!REDUNDANT_EXPLICIT_TYPE!>Double<!> = 3.14 val <!UNUSED_VARIABLE!>piDouble<!>: <!REDUNDANT_EXPLICIT_TYPE!>Double<!> = 3.14
val charZ: <!REDUNDANT_EXPLICIT_TYPE!>Char<!> = 'z' val <!UNUSED_VARIABLE!>charZ<!>: <!REDUNDANT_EXPLICIT_TYPE!>Char<!> = 'z'
<!CAN_BE_VAL!>var<!> alpha: <!REDUNDANT_EXPLICIT_TYPE!>Int<!> = 0 <!CAN_BE_VAL!>var<!> <!UNUSED_VARIABLE!>alpha<!>: <!REDUNDANT_EXPLICIT_TYPE!>Int<!> = 0
} }
fun test(boolean: Boolean) { fun test(boolean: Boolean) {
val expectedLong: Long = if (boolean) { val <!UNUSED_VARIABLE!>expectedLong<!>: Long = if (boolean) {
42 42
} else { } else {
return return
@@ -70,7 +70,7 @@ class My {
val ZERO: Int = 0 val ZERO: Int = 0
fun main() { fun main() {
val id: Id = 11 val <!UNUSED_VARIABLE!>id<!>: Id = 11
} }
typealias Id = Int typealias Id = Int
@@ -1,5 +1,5 @@
fun f() { fun f() {
<!REDUNDANT_VISIBILITY_MODIFIER!>public<!> <!CAN_BE_VAL!>var<!> baz = 0 <!REDUNDANT_VISIBILITY_MODIFIER!>public<!> <!CAN_BE_VAL!>var<!> <!UNUSED_VARIABLE!>baz<!> = 0
class LocalClass { class LocalClass {
<!REDUNDANT_VISIBILITY_MODIFIER!>internal<!> var foo = 0 <!REDUNDANT_VISIBILITY_MODIFIER!>internal<!> var foo = 0
} }
@@ -75,12 +75,12 @@ open class J {
} }
var buf = 0 var buf = 0
private get() = 42 private get() = 42
protected set(value) { protected set(value) {
field = value field = value
} }
var bar = 0 var bar = 0
get() = 3.1415926535 get() = 3.1415926535
set(value) {} set(value) {}
} }
@@ -3,5 +3,5 @@ fun goo() {
val b = 4 val b = 4
a <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> a + 1 + b a <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> a + 1 + b
a <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> (a + 1) a <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> (a + 1)
a = a * b + 1 <!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = a * b + 1
} }
@@ -1,4 +1,4 @@
fun foo() { fun foo() {
var a = 0 var a = 0
a = (a + 1) / 2 <!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = (a + 1) / 2
} }
@@ -1,4 +1,4 @@
fun foo() { fun foo() {
var a = 0 var a = 0
a += 10 + a <!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> += 10 + a
} }
@@ -2,5 +2,5 @@
fun foo() { fun foo() {
var list1 = java.util.Collections.emptyList<String>() var list1 = java.util.Collections.emptyList<String>()
val list2 = listOf("b") val list2 = listOf("b")
list1 = list1 + list2 <!ASSIGNED_VALUE_IS_NEVER_READ!>list1<!> = list1 + list2
} }
@@ -1,4 +1,4 @@
fun foo() { fun foo() {
var x = 0 var x = 0
x = x / 1 + 1 <!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> = x / 1 + 1
} }
@@ -1,5 +1,5 @@
fun foo() { fun foo() {
var x = 0 var x = 0
val y = 0 val y = 0
x = y / x + 0 <!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> = y / x + 0
} }
@@ -1,4 +1,4 @@
fun foo() { fun foo() {
var x = 0 var x = 0
x = 1 - x <!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> = 1 - x
} }
@@ -3,5 +3,5 @@ fun foo() {
var list = listOf(1, 2, 3) var list = listOf(1, 2, 3)
// Should not be highlighted because it's the way we use to say explicitly // Should not be highlighted because it's the way we use to say explicitly
// "yes, we want to re-assign this immutable list" // "yes, we want to re-assign this immutable list"
list = list + 4 <!ASSIGNED_VALUE_IS_NEVER_READ!>list<!> = list + 4
} }
@@ -1,4 +1,4 @@
fun foo(something: Boolean) { fun foo(something: Boolean) {
var res = false var res = false
res = res and something <!ASSIGNED_VALUE_IS_NEVER_READ!>res<!> = res and something
} }
@@ -1,5 +1,5 @@
fun foo() { fun foo() {
var x = 0 var x = 0
<!CAN_BE_VAL!>var<!> y = 0 <!CAN_BE_VAL!>var<!> y = 0
x <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> x + y + 5 <!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> x + y + 5
} }
@@ -1,5 +1,5 @@
fun foo() { fun foo() {
var x = 0 var x = 0
<!CAN_BE_VAL!>var<!> y = 0 <!CAN_BE_VAL!>var<!> y = 0
x <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> y + x + 5 <!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> y + x + 5
} }
@@ -5,5 +5,5 @@ fun foo() {
// now, Idea hightlights this code like error (cuz listVar // now, Idea hightlights this code like error (cuz listVar
// is mutable and listVar + 4 is immutable) and like warning // is mutable and listVar + 4 is immutable) and like warning
// (cuz can be replaced with +=) // (cuz can be replaced with +=)
listVar = listVar + 4 <!ASSIGNED_VALUE_IS_NEVER_READ!>listVar<!> = listVar + 4
} }
@@ -4,5 +4,5 @@ fun foo() {
x <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> x / 1 x <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> x / 1
x = 1 / x x = 1 / x
x <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> -1 + x <!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> -1 + x
} }
@@ -1,6 +1,6 @@
fun foo() { fun foo() {
var x = 0 var <!VARIABLE_NEVER_READ!>x<!> = 0
val y = 0 val y = 0
val z = 0 val z = 0
x = y + z <!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> = y + z
} }
@@ -6,5 +6,5 @@ operator fun A.plusAssign(a: A){}
fun foo() { fun foo() {
var a1 = A() var a1 = A()
val a2 = A() val a2 = A()
a1 = a1 + a2 <!ASSIGNED_VALUE_IS_NEVER_READ!>a1<!> = a1 + a2
} }
@@ -1,4 +1,4 @@
fun foo() { fun foo() {
var x = 0 var x = 0
x <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> 1 + x <!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> 1 + x
} }
@@ -1,5 +1,5 @@
fun foo() { fun foo() {
var y = 0 var y = 0
val x = 0 val x = 0
y <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> y + x <!ASSIGNED_VALUE_IS_NEVER_READ!>y<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> y + x
} }
@@ -1,4 +1,4 @@
fun foo() { fun foo() {
var x = 0 var x = 0
x <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> x + 1 <!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> x + 1
} }
@@ -1,4 +1,4 @@
fun foo() { fun foo() {
var x = 0 var x = 0
x <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> x - 1 <!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> x - 1
} }
@@ -3,7 +3,7 @@
fun foo() { fun foo() {
for (i in 1..2) { } for (i in 1..2) { }
val a = 3..4 val <!UNUSED_VARIABLE!>a<!> = 3..4
val v = 1 val v = 1
if (v in 5..6) { } if (v in 5..6) { }
@@ -13,7 +13,7 @@ fun foo() {
fun backward() { fun backward() {
for (i in 2 downTo 1) { } for (i in 2 downTo 1) { }
val a = 4 downTo 3 val <!UNUSED_VARIABLE!>a<!> = 4 downTo 3
val v = 1 val v = 1
if (v in -5 downTo -6) { } if (v in -5 downTo -6) { }
@@ -22,7 +22,7 @@ fun backward() {
fun until() { fun until() {
for (i in 1 until 2) { } for (i in 1 until 2) { }
val a = 3 until 4 val <!UNUSED_VARIABLE!>a<!> = 3 until 4
val v = 1 val v = 1
if (v in -5 until -4) { } if (v in -5 until -4) { }
@@ -3,7 +3,7 @@
fun foo() { fun foo() {
for (i in <!EMPTY_RANGE!>2..1<!>) { } for (i in <!EMPTY_RANGE!>2..1<!>) { }
val a = <!EMPTY_RANGE!>10..0<!> val <!UNUSED_VARIABLE!>a<!> = <!EMPTY_RANGE!>10..0<!>
val v = 1 val v = 1
if (v in <!EMPTY_RANGE!>10..1<!>) { } if (v in <!EMPTY_RANGE!>10..1<!>) { }
@@ -12,7 +12,7 @@ fun foo() {
fun backward() { fun backward() {
for (i in <!EMPTY_RANGE!>1 downTo 2<!>) { } for (i in <!EMPTY_RANGE!>1 downTo 2<!>) { }
val a = <!EMPTY_RANGE!>-3 downTo 4<!> val <!UNUSED_VARIABLE!>a<!> = <!EMPTY_RANGE!>-3 downTo 4<!>
val v = 1 val v = 1
if (v in <!EMPTY_RANGE!>0 downTo 6<!>) { } if (v in <!EMPTY_RANGE!>0 downTo 6<!>) { }
@@ -21,7 +21,7 @@ fun backward() {
fun until() { fun until() {
for (i in <!EMPTY_RANGE!>1 until 1<!>) { } for (i in <!EMPTY_RANGE!>1 until 1<!>) { }
val a = <!EMPTY_RANGE!>4 until 3<!> val <!UNUSED_VARIABLE!>a<!> = <!EMPTY_RANGE!>4 until 3<!>
val v = 1 val v = 1
if (v in <!EMPTY_RANGE!>-5 until -5<!>) { } if (v in <!EMPTY_RANGE!>-5 until -5<!>) { }
@@ -0,0 +1,9 @@
class A {
var v: String? = null
}
fun foo(): String? {
val t = A().v
return t
}
@@ -0,0 +1,15 @@
FILE: classProperty.kt
public final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final var v: R|kotlin/String?| = Null(null)
public get(): R|kotlin/String?|
public set(value: R|kotlin/String?|): R|kotlin/Unit|
}
public final fun foo(): R|kotlin/String?| {
lval t: R|kotlin/String?| = R|/A.A|().R|/A.v|
^foo R|<local>/t|
}
@@ -0,0 +1,9 @@
fun f(t: (v: Int) -> Unit) {
1.run(t)
}
fun main() {
f { i ->
}
}
@@ -0,0 +1,10 @@
FILE: lambda.kt
public final fun f(t: R|(kotlin/Int) -> kotlin/Unit|): R|kotlin/Unit| {
Int(1).R|kotlin/run|<R|kotlin/Int|, R|kotlin/Unit|>(R|<local>/t|)
}
public final fun main(): R|kotlin/Unit| {
R|/f|(<L> = f@fun <anonymous>(i: R|kotlin/Int|): R|kotlin/Unit| {
^@f Unit
}
)
}
@@ -0,0 +1,42 @@
import kotlin.reflect.KProperty
class Outer {
fun foo() {
class Local {
fun bar() {
val <!UNUSED_VARIABLE!>x<!> = y
}
}
}
val y = ""
}
fun f() {
val a = 1
fun g(): Int {
return a
}
}
fun foo(v: Int) {
val <!UNUSED_VARIABLE!>d<!>: Int by Delegate
val <!UNUSED_VARIABLE!>a<!>: Int
val <!UNUSED_VARIABLE!>b<!> = 1
val c = 2
@Anno
val <!UNUSED_VARIABLE!>e<!>: Int
foo(c)
}
object Delegate {
operator fun getValue(instance: Any?, property: KProperty<*>) = 1
operator fun setValue(instance: Any?, property: KProperty<*>, value: String) {}
}
@Target(AnnotationTarget.LOCAL_VARIABLE)
annotation class Anno
@@ -0,0 +1,58 @@
FILE: localVariable.kt
public final class Outer : R|kotlin/Any| {
public constructor(): R|Outer| {
super<R|kotlin/Any|>()
}
public final fun foo(): R|kotlin/Unit| {
local final class Local : R|kotlin/Any| {
public constructor(): R|Outer.Local| {
super<R|kotlin/Any|>()
}
public final fun bar(): R|kotlin/Unit| {
lval x: R|kotlin/String| = this@R|/Outer|.R|/Outer.y|
}
}
}
public final val y: R|kotlin/String| = String()
public get(): R|kotlin/String|
}
public final fun f(): R|kotlin/Unit| {
lval a: R|kotlin/Int| = Int(1)
local final fun g(): R|kotlin/Int| {
^g R|<local>/a|
}
}
public final fun foo(v: R|kotlin/Int|): R|kotlin/Unit| {
lval d: R|kotlin/Int|by Q|Delegate|
lval a: R|kotlin/Int|
lval b: R|kotlin/Int| = Int(1)
lval c: R|kotlin/Int| = Int(2)
@R|Anno|() lval e: R|kotlin/Int|
R|/foo|(R|<local>/c|)
}
public final object Delegate : R|kotlin/Any| {
private constructor(): R|Delegate| {
super<R|kotlin/Any|>()
}
public final operator fun getValue(instance: R|kotlin/Any?|, property: R|kotlin/reflect/KProperty<*>|): R|kotlin/Int| {
^getValue Int(1)
}
public final operator fun setValue(instance: R|kotlin/Any?|, property: R|kotlin/reflect/KProperty<*>|, value: R|kotlin/String|): R|kotlin/Unit| {
}
}
@R|kotlin/annotation/Target|(vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.LOCAL_VARIABLE|)) public final annotation class Anno : R|kotlin/Annotation| {
public constructor(): R|Anno| {
super<R|kotlin/Any|>()
}
}
@@ -0,0 +1,19 @@
fun foo() {
<!CAN_BE_VAL!>var<!> a = 1
var b = <!VARIABLE_INITIALIZER_IS_REDUNDANT!>2<!>
var c = 3
for (i in 0..5) {
if (a == 2) {
<!ASSIGNED_VALUE_IS_NEVER_READ!>b<!> = c
c = a
} else {
b = a
c = b
}
}
if (c == a) {
foo()
}
}
@@ -0,0 +1,28 @@
FILE: manyLocalVariables.kt
public final fun foo(): R|kotlin/Unit| {
lvar a: R|kotlin/Int| = Int(1)
lvar b: R|kotlin/Int| = Int(2)
lvar c: R|kotlin/Int| = Int(3)
lval <iterator>: R|kotlin/collections/IntIterator| = Int(0).R|kotlin/Int.rangeTo|(Int(5)).R|kotlin/ranges/IntProgression.iterator|()
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
lval i: R|kotlin/Int| = R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()
when () {
==(R|<local>/a|, Int(2)) -> {
R|<local>/b| = R|<local>/c|
R|<local>/c| = R|<local>/a|
}
else -> {
R|<local>/b| = R|<local>/a|
R|<local>/c| = R|<local>/b|
}
}
}
when () {
==(R|<local>/c|, R|<local>/a|) -> {
R|/foo|()
}
}
}
@@ -0,0 +1,6 @@
fun foo() {
var a = <!VARIABLE_INITIALIZER_IS_REDUNDANT!>1<!>
<!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = 2
a = 3
<!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> += 1
}
@@ -0,0 +1,7 @@
FILE: valueIsNeverRead.kt
public final fun foo(): R|kotlin/Unit| {
lvar a: R|kotlin/Int| = Int(1)
R|<local>/a| = Int(2)
R|<local>/a| = Int(3)
R|<local>/a| = R|<local>/a|.R|kotlin/Int.plus|(Int(1))
}
@@ -33,6 +33,11 @@ public class ExtendedFirDiagnosticsTestGenerated extends AbstractExtendedFirDiag
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/ArrayEqualityCanBeReplacedWithEquals.kt"); runTest("compiler/fir/analysis-tests/testData/extendedCheckers/ArrayEqualityCanBeReplacedWithEquals.kt");
} }
@TestMetadata("CanBeValChecker.kt")
public void testCanBeValChecker() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/CanBeValChecker.kt");
}
@TestMetadata("RedundantExplicitTypeChecker.kt") @TestMetadata("RedundantExplicitTypeChecker.kt")
public void testRedundantExplicitTypeChecker() throws Exception { public void testRedundantExplicitTypeChecker() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/RedundantExplicitTypeChecker.kt"); runTest("compiler/fir/analysis-tests/testData/extendedCheckers/RedundantExplicitTypeChecker.kt");
@@ -63,11 +68,6 @@ public class ExtendedFirDiagnosticsTestGenerated extends AbstractExtendedFirDiag
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/RedundantVisibilityModifierChecker.kt"); runTest("compiler/fir/analysis-tests/testData/extendedCheckers/RedundantVisibilityModifierChecker.kt");
} }
@TestMetadata("VariableAssignmentChecker.kt")
public void testVariableAssignmentChecker() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/VariableAssignmentChecker.kt");
}
@TestMetadata("compiler/fir/analysis-tests/testData/extendedCheckers/canBeReplacedWithOperatorAssignment") @TestMetadata("compiler/fir/analysis-tests/testData/extendedCheckers/canBeReplacedWithOperatorAssignment")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
@@ -311,4 +311,42 @@ public class ExtendedFirDiagnosticsTestGenerated extends AbstractExtendedFirDiag
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/RedundantCallOfConversionMethod/variable.kt"); runTest("compiler/fir/analysis-tests/testData/extendedCheckers/RedundantCallOfConversionMethod/variable.kt");
} }
} }
@TestMetadata("compiler/fir/analysis-tests/testData/extendedCheckers/unused")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Unused extends AbstractExtendedFirDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInUnused() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/extendedCheckers/unused"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("classProperty.kt")
public void testClassProperty() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/classProperty.kt");
}
@TestMetadata("lambda.kt")
public void testLambda() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/lambda.kt");
}
@TestMetadata("localVariable.kt")
public void testLocalVariable() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/localVariable.kt");
}
@TestMetadata("manyLocalVariables.kt")
public void testManyLocalVariables() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/manyLocalVariables.kt");
}
@TestMetadata("valueIsNeverRead.kt")
public void testValueIsNeverRead() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/valueIsNeverRead.kt");
}
}
} }
@@ -33,6 +33,11 @@ public class ExtendedFirWithLightTreeDiagnosticsTestGenerated extends AbstractEx
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/ArrayEqualityCanBeReplacedWithEquals.kt"); runTest("compiler/fir/analysis-tests/testData/extendedCheckers/ArrayEqualityCanBeReplacedWithEquals.kt");
} }
@TestMetadata("CanBeValChecker.kt")
public void testCanBeValChecker() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/CanBeValChecker.kt");
}
@TestMetadata("RedundantExplicitTypeChecker.kt") @TestMetadata("RedundantExplicitTypeChecker.kt")
public void testRedundantExplicitTypeChecker() throws Exception { public void testRedundantExplicitTypeChecker() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/RedundantExplicitTypeChecker.kt"); runTest("compiler/fir/analysis-tests/testData/extendedCheckers/RedundantExplicitTypeChecker.kt");
@@ -63,11 +68,6 @@ public class ExtendedFirWithLightTreeDiagnosticsTestGenerated extends AbstractEx
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/RedundantVisibilityModifierChecker.kt"); runTest("compiler/fir/analysis-tests/testData/extendedCheckers/RedundantVisibilityModifierChecker.kt");
} }
@TestMetadata("VariableAssignmentChecker.kt")
public void testVariableAssignmentChecker() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/VariableAssignmentChecker.kt");
}
@TestMetadata("compiler/fir/analysis-tests/testData/extendedCheckers/canBeReplacedWithOperatorAssignment") @TestMetadata("compiler/fir/analysis-tests/testData/extendedCheckers/canBeReplacedWithOperatorAssignment")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
@@ -311,4 +311,42 @@ public class ExtendedFirWithLightTreeDiagnosticsTestGenerated extends AbstractEx
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/RedundantCallOfConversionMethod/variable.kt"); runTest("compiler/fir/analysis-tests/testData/extendedCheckers/RedundantCallOfConversionMethod/variable.kt");
} }
} }
@TestMetadata("compiler/fir/analysis-tests/testData/extendedCheckers/unused")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Unused extends AbstractExtendedFirWithLightTreeDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInUnused() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/extendedCheckers/unused"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("classProperty.kt")
public void testClassProperty() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/classProperty.kt");
}
@TestMetadata("lambda.kt")
public void testLambda() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/lambda.kt");
}
@TestMetadata("localVariable.kt")
public void testLocalVariable() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/localVariable.kt");
}
@TestMetadata("manyLocalVariables.kt")
public void testManyLocalVariables() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/manyLocalVariables.kt");
}
@TestMetadata("valueIsNeverRead.kt")
public void testValueIsNeverRead() throws Exception {
runTest("compiler/fir/analysis-tests/testData/extendedCheckers/unused/valueIsNeverRead.kt");
}
}
} }