More correct algorithm for redundant type arguments detection
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
// IS_APPLICABLE: true
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun f(p: Int): List<String>? {
|
||||
return if (p > 0) {
|
||||
print("a")
|
||||
listOf<caret><String>()
|
||||
}
|
||||
else {
|
||||
null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// IS_APPLICABLE: true
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun f(p: Int): List<String>? {
|
||||
return if (p > 0) {
|
||||
print("a")
|
||||
listOf()
|
||||
}
|
||||
else {
|
||||
null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(p: List<String> = listOf<caret><String>()) {
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(p: List<String> = listOf()) {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
// WITH_RUNTIME
|
||||
|
||||
val x: List<String>
|
||||
get() = listOf<caret><String>()
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
// WITH_RUNTIME
|
||||
|
||||
val x: List<String>
|
||||
get() = listOf()
|
||||
+56
-3
@@ -138,7 +138,7 @@
|
||||
<file>insideOtherCall.kt</file>
|
||||
<line>5</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/insideOtherCall.kt" />
|
||||
<entry_point TYPE="file" FQNAME="insideOtherCall.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unnecessary type argument</problem_class>
|
||||
<description>Remove explicit type arguments</description>
|
||||
</problem>
|
||||
@@ -147,7 +147,7 @@
|
||||
<file>insideDeepOtherCall.kt</file>
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/insideDeepOtherCall.kt" />
|
||||
<entry_point TYPE="file" FQNAME="insideDeepOtherCall.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unnecessary type argument</problem_class>
|
||||
<description>Remove explicit type arguments</description>
|
||||
</problem>
|
||||
@@ -156,9 +156,62 @@
|
||||
<file>insideDeepOtherCall.kt</file>
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/insideDeepOtherCall.kt" />
|
||||
<entry_point TYPE="file" FQNAME="insideDeepOtherCall.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unnecessary type argument</problem_class>
|
||||
<description>Remove explicit type arguments</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>twoArguments.kt</file>
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="twoArguments.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unnecessary type argument</problem_class>
|
||||
<description>Remove explicit type arguments</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>twoArguments.kt</file>
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="twoArguments.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unnecessary type argument</problem_class>
|
||||
<description>Remove explicit type arguments</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>qualified.kt</file>
|
||||
<line>6</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="qualified.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unnecessary type argument</problem_class>
|
||||
<description>Remove explicit type arguments</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>getterBody.kt</file>
|
||||
<line>5</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="getterBody.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unnecessary type argument</problem_class>
|
||||
<description>Remove explicit type arguments</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>defaultParamValue.kt</file>
|
||||
<line>4</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="defaultParamValue.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unnecessary type argument</problem_class>
|
||||
<description>Remove explicit type arguments</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>blockValue.kt</file>
|
||||
<line>7</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="blockValue.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unnecessary type argument</problem_class>
|
||||
<description>Remove explicit type arguments</description>
|
||||
</problem>
|
||||
</problems>
|
||||
@@ -0,0 +1,7 @@
|
||||
interface I<T>
|
||||
|
||||
fun <T> Int.foo(p: I<T>){}
|
||||
|
||||
fun bar(p: I<String>) {
|
||||
1.foo<caret><String>(p)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
interface I<T>
|
||||
|
||||
fun <T> Int.foo(p: I<T>){}
|
||||
|
||||
fun bar(p: I<String>) {
|
||||
1.foo(p)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// IS_APPLICABLE: true
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun <T> foo(p1: List<T>, p2: List<T>) {
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
foo(listOf<caret><String>(), listOf<String>())
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// IS_APPLICABLE: true
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun <T> foo(p1: List<T>, p2: List<T>) {
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
foo(listOf(), listOf<String>())
|
||||
}
|
||||
Reference in New Issue
Block a user