Testing highlight type for all "unused" diagnostics.
This commit is contained in:
@@ -5,12 +5,12 @@ fun test() : Unit {
|
||||
x : Int?
|
||||
y : Int
|
||||
x as Int : Int
|
||||
y <warning textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES">as Int</warning> : Int
|
||||
x <warning textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES">as Int?</warning> : Int?
|
||||
y <warning textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES">as Int?</warning> : Int?
|
||||
y <warning>as Int</warning> : Int
|
||||
x <warning>as Int?</warning> : Int?
|
||||
y <warning>as Int?</warning> : Int?
|
||||
x as? Int : Int?
|
||||
y <warning textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES">as? Int</warning> : Int?
|
||||
x <warning textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES">as? Int?</warning> : Int?
|
||||
y <warning textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES">as? Int?</warning> : Int?
|
||||
y <warning>as? Int</warning> : Int?
|
||||
x <warning>as? Int?</warning> : Int?
|
||||
y <warning>as? Int?</warning> : Int?
|
||||
Unit
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
fun test(<warning textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES">unusedParam</warning>: Int) { // UNUSED_PARAMETER
|
||||
val str = ":)"
|
||||
str <warning textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES">as String</warning> // USELESS_CAST
|
||||
str <warning textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES">as Any</warning> // USELESS_CAST_STATIC_ASSERT_IS_FINE
|
||||
|
||||
// UNUSED_FUNCTION_LITERAL
|
||||
<warning textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES">{
|
||||
test(0)
|
||||
}</warning>
|
||||
|
||||
val <warning textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES">unusedVar</warning> = ":(" // UNUSED_VARIABLE
|
||||
var <warning textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES">neverAccessed</warning>: Int // ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE
|
||||
neverAccessed = <warning>2</warning>
|
||||
|
||||
var redundantInitializer = <warning textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES">1</warning> // VARIABLE_WITH_REDUNDANT_INITIALIZER
|
||||
redundantInitializer = 2
|
||||
test(redundantInitializer)
|
||||
}
|
||||
|
||||
@@ -339,6 +339,12 @@ public class JetPsiCheckerTestGenerated extends AbstractJetPsiCheckerTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Unused.kt")
|
||||
public void testUnused() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/Unused.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Variance.kt")
|
||||
public void testVariance() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/Variance.kt");
|
||||
|
||||
Reference in New Issue
Block a user