Handle expected type more precisely in RemoveExplicitTypeArguments
So #KT-17623 Fixed
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(f: ListWrapper<Int>) {}
|
||||
|
||||
class ListWrapper<T>(val x: List<T>)
|
||||
|
||||
fun f() {
|
||||
foo(ListWrapper<Int>(listOf<caret><Int>()))
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(f: ListWrapper<Int>) {}
|
||||
|
||||
class ListWrapper<T>(val x: List<T>)
|
||||
|
||||
fun f() {
|
||||
foo(ListWrapper<Int>(listOf()))
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// IS_APPLICABLE: false
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun <T> foo(list: List<T>): Int = 0
|
||||
|
||||
fun bar(): Int {
|
||||
return foo(listOf<caret><String>())
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class ListWrapper<T>(val x: List<T>)
|
||||
|
||||
val list: ListWrapper<Int> = ListWrapper(listOf<caret><Int>())
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class ListWrapper<T>(val x: List<T>)
|
||||
|
||||
val list: ListWrapper<Int> = ListWrapper(listOf())
|
||||
+28
@@ -133,4 +133,32 @@
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Type arguments are unnecessary</problem_class>
|
||||
<description>Remove explicit type arguments</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>insideOtherCall.kt</file>
|
||||
<line>5</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/insideOtherCall.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unnecessary type argument</problem_class>
|
||||
<description>Remove explicit type arguments</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>insideDeepOtherCall.kt</file>
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/insideDeepOtherCall.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unnecessary type argument</problem_class>
|
||||
<description>Remove explicit type arguments</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>insideDeepOtherCall.kt</file>
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/insideDeepOtherCall.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unnecessary type argument</problem_class>
|
||||
<description>Remove explicit type arguments</description>
|
||||
</problem>
|
||||
|
||||
</problems>
|
||||
+1
-1
@@ -3,7 +3,7 @@ class Foo {
|
||||
fun method(b: Boolean,
|
||||
elementComputable: Computable<String>,
|
||||
processingContext: Any): WeighingComparable<String, ProximityLocation> {
|
||||
return WeighingComparable(elementComputable, ProximityLocation(), Array<Weigher<*, *>>(0) { null!! })
|
||||
return WeighingComparable(elementComputable, ProximityLocation(), Array(0) { null!! })
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
Vendored
+1
-1
@@ -3,5 +3,5 @@ import java.util.ArrayList
|
||||
fun f() {
|
||||
val v : List<Int> = listOf()
|
||||
val copy1: List<Int> = ArrayList(<caret>v)
|
||||
val copy2: = ArrayList(v)
|
||||
val copy2 = ArrayList(v)
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@ import java.util.ArrayList
|
||||
|
||||
fun f() {
|
||||
val copy1: List<Int> = ArrayList(listOf())
|
||||
val copy2: = ArrayList(listOf<Int>())
|
||||
val copy2 = ArrayList(listOf<Int>())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user