KT-7693 Unused constructor parameter is not detected if class is constructed with named argument

#KT-7693 fixed
This commit is contained in:
Evgeny Gerashchenko
2015-05-25 12:27:13 +03:00
parent 3c7225e83a
commit 0488229a61
10 changed files with 59 additions and 2 deletions
@@ -6,4 +6,12 @@ open class A<T>(<caret>foo: T) {
}
val t: T = foo
fun usage() {
return A(foo = ":)")
}
}
fun usage() {
A(foo = ":)")
}
@@ -1,2 +1,4 @@
Named argument (11: 18) return A(foo = ":)")
Named argument (16: 7) A(foo = ":)")
Value read (5: 17) println(foo)
Value read (8: 16) val t: T = foo
@@ -4,3 +4,7 @@ fun foo<T>(<caret>t: T): T {
println(t)
return t
}
fun usage() {
foo(t = ":)")
}
@@ -1,2 +1,3 @@
Named argument (9: 9) foo(t = ":)")
Value read (4: 13) println(t)
Value read (5: 12) return t
@@ -7,4 +7,22 @@
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused Symbol</problem_class>
<description>Property 'param' is never used</description>
</problem>
<problem>
<file>paramPropertyUsedOnlyAsNamedArgument.kt</file>
<line>1</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/paramPropertyUsedOnlyAsNamedArgument.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused Symbol</problem_class>
<description>Property 'param1' is never used</description>
</problem>
<problem>
<file>paramPropertyUsedOnlyAsNamedArgument.kt</file>
<line>1</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/paramPropertyUsedOnlyAsNamedArgument.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused Symbol</problem_class>
<description>Property 'param2' is never used</description>
</problem>
</problems>
@@ -0,0 +1,5 @@
class C(val param1: Int, val param2: Int)
fun main(args: Array<String>) {
C(1, param2 = 1)
}