Introduced "Unused receiver parameter" inspection.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
fun String.foo() {
|
||||
println(length())
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
private fun String.foo() {
|
||||
otherExt()
|
||||
}
|
||||
|
||||
fun String.otherExt() = length()
|
||||
@@ -0,0 +1,34 @@
|
||||
<problems>
|
||||
<problem>
|
||||
<file>unusedInProperty.kt</file>
|
||||
<line>1</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/unusedInProperty.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused receiver parameter</problem_class>
|
||||
<description>Receiver parameter is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>unusedInFunction.kt</file>
|
||||
<line>1</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/unusedInFunction.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused receiver parameter</problem_class>
|
||||
<description>Receiver parameter is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>irrelevantThisInFunction.kt</file>
|
||||
<line>1</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/irrelevantThisInFunction.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused receiver parameter</problem_class>
|
||||
<description>Receiver parameter is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>irrelevantCallInFunction.kt</file>
|
||||
<line>1</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/irrelevantCallInFunction.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused receiver parameter</problem_class>
|
||||
<description>Receiver parameter is never used</description>
|
||||
</problem>
|
||||
</problems>
|
||||
@@ -0,0 +1 @@
|
||||
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.UnusedReceiverParameterInspection
|
||||
@@ -0,0 +1,5 @@
|
||||
fun String.foo() {
|
||||
fun String.local() {
|
||||
println(length())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fun Any.foo() {
|
||||
fun Any.local() {
|
||||
println(this)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
open class Foo {
|
||||
open fun Any.foo() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class Bar: Foo() {
|
||||
override fun Any.foo() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun String.foo() {
|
||||
println()
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
val String.something: Int
|
||||
get() = 42
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
"".something
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun String.foo() {
|
||||
println(this)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
val String.doubleLength: Int
|
||||
get() = length() * 2
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
"".doubleLength
|
||||
}
|
||||
Reference in New Issue
Block a user