K2: Fix false-positive OVERLOAD_RESOLUTION_AMBIGUITY
It's been introduced in the previous commit
("K2: Simplify handling mixed smartcast vs. original candidates")
Because previously, it was assumed wrongly that each next level of
ConeCallConflictResolver filter out the candidates that are 100% less
applicable/specific, but the main one (ConeOverloadConflictResolver)
either leaves the single candidate or the whole same set, thus at
FilteringOutOriginalInPresenceOfSmartCastConeCallConflictResolver
we've got 4 candidates only two of which we might filter out.
This commit is contained in:
committed by
Space Team
parent
1e1d122dd3
commit
b4b443034f
+23
@@ -0,0 +1,23 @@
|
||||
// SKIP_TXT
|
||||
// FIR_IDENTICAL
|
||||
|
||||
abstract class A {
|
||||
open public fun foo(x: Any) {}
|
||||
open public fun foo(x: String) {}
|
||||
}
|
||||
|
||||
class B : A() {
|
||||
override fun foo(x: Any) {
|
||||
super.foo(x)
|
||||
}
|
||||
|
||||
override fun foo(x: String) {
|
||||
super.foo(x)
|
||||
}
|
||||
}
|
||||
|
||||
fun bar(a: A) {
|
||||
if (a is B) {
|
||||
a.foo("")
|
||||
}
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// SKIP_TXT
|
||||
// FIR_IDENTICAL
|
||||
|
||||
abstract class A {
|
||||
open public fun foo(x: Any): Any = x
|
||||
open public fun foo(x: String): String = x
|
||||
}
|
||||
|
||||
class B : A() {
|
||||
override fun foo(x: Any): Any = x
|
||||
override fun foo(x: String): String = x
|
||||
}
|
||||
|
||||
fun bar(a: A) {
|
||||
if (a is B) {
|
||||
a.foo("").length
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user