Don't issue compatibility warning for the candidates in the same group
This commit is contained in:
@@ -313,6 +313,7 @@ class TowerResolver {
|
|||||||
override fun getSuccessfulCandidates(): Collection<C>? {
|
override fun getSuccessfulCandidates(): Collection<C>? {
|
||||||
if (!isSuccessful) return null
|
if (!isSuccessful) return null
|
||||||
var compatibilityCandidate: C? = null
|
var compatibilityCandidate: C? = null
|
||||||
|
var compatibilityGroup: Collection<C>? = null
|
||||||
var firstGroupWithResolved: Collection<C>? = null
|
var firstGroupWithResolved: Collection<C>? = null
|
||||||
outer@ for (group in candidateGroups) {
|
outer@ for (group in candidateGroups) {
|
||||||
for (candidate in group) {
|
for (candidate in group) {
|
||||||
@@ -322,13 +323,14 @@ class TowerResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (compatibilityCandidate == null && isSuccessfulPreserveCompatibility(candidate)) {
|
if (compatibilityCandidate == null && isSuccessfulPreserveCompatibility(candidate)) {
|
||||||
|
compatibilityGroup = group
|
||||||
compatibilityCandidate = candidate
|
compatibilityCandidate = candidate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstGroupWithResolved == null) return null
|
if (firstGroupWithResolved == null) return null
|
||||||
if (compatibilityCandidate != null) {
|
if (compatibilityCandidate != null && compatibilityGroup !== firstGroupWithResolved) {
|
||||||
firstGroupWithResolved.forEach { it.addCompatibilityWarning(compatibilityCandidate) }
|
firstGroupWithResolved.forEach { it.addCompatibilityWarning(compatibilityCandidate) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -40,7 +40,7 @@ object Test3 {
|
|||||||
fun foo(n: Number, f: () -> Unit): String = ""
|
fun foo(n: Number, f: () -> Unit): String = ""
|
||||||
|
|
||||||
fun test(f: () -> Unit) {
|
fun test(f: () -> Unit) {
|
||||||
val result = <!COMPATIBILITY_WARNING!>foo(1, f)<!>
|
val result = foo(1, f)
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>result<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>result<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ object Test4 {
|
|||||||
fun bar() {}
|
fun bar() {}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val result = <!COMPATIBILITY_WARNING!>foo(1, ::bar)<!>
|
val result = foo(1, ::bar)
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>result<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>result<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user