724d527fd8
Let ConeCompositeConflictResolver pass the results of the previous resolver to the next one. Otherwise, we get false positive conflicts when a set of candidates can't be fully reduced by one resolver but could be resolved by the subsequent application of multiple ones. This change makes ConeCompositeConflictResolver order-dependent and thus, ConeOverloadConflictResolver must be invoked last, because it must work on a pre-filtered list. Also, let ConeEquivalentCallConflictResolver use FirStandardOverrideChecker instead of compareCallsByUsedArguments because it's stricter. This all fixes a false positive overload resolution ambiguity in common metadata compilation that is caused by stdlib using the new KMP format. Now stdlib metadata is in the classpath, and so declarations from the stdlib are returned from both MetadataSymbolProvider and KlibBasedSymbolProvider. This isn't a problem per se because duplicate candidates are filtered out by ConeEquivalentCallConflictResolver (K1 works analogously), but in the case of top-level functions with generic receivers like Collection<T>.toTypedArray, the check failed because of the direct comparison of receiver types. #KT-60943 Fixed
50 lines
1.3 KiB
Kotlin
Vendored
50 lines
1.3 KiB
Kotlin
Vendored
// FILE: a.kt
|
|
package a
|
|
|
|
interface A
|
|
interface B : A
|
|
|
|
private fun validFun() {}
|
|
private val validVal = 1
|
|
|
|
<!CONFLICTING_OVERLOADS!>private fun invalidFun0()<!> {}
|
|
private val <!REDECLARATION!>invalidProp0<!> = 1
|
|
|
|
// NB invalidFun0 and invalidProp0 are conflicting overloads, since the following is an ambiguity:
|
|
fun useInvalidFun0() = <!OVERLOAD_RESOLUTION_AMBIGUITY!>invalidFun0<!>()
|
|
fun useInvalidProp0() = <!OVERLOAD_RESOLUTION_AMBIGUITY!>invalidProp0<!>
|
|
|
|
<!CONFLICTING_OVERLOADS!>private fun invalidFun1()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>private fun invalidFun1()<!> {}
|
|
|
|
<!CONFLICTING_OVERLOADS!>private fun invalidFun2()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>public fun invalidFun2()<!> {}
|
|
|
|
<!CONFLICTING_OVERLOADS!>public fun invalidFun3()<!> {}
|
|
|
|
<!CONFLICTING_OVERLOADS!>private fun invalidFun4()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>public fun invalidFun4()<!> {}
|
|
|
|
public fun validFun2(a: A) = a
|
|
public fun validFun2(b: B) = b
|
|
|
|
// FILE: b.kt
|
|
package a
|
|
|
|
private fun validFun() {}
|
|
private val validVal = 1
|
|
|
|
<!CONFLICTING_OVERLOADS!>private fun invalidFun0()<!> {}
|
|
|
|
private val <!REDECLARATION!>invalidProp0<!> = 1
|
|
|
|
<!CONFLICTING_OVERLOADS!>internal fun invalidFun3()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>internal fun invalidFun4()<!> {}
|
|
|
|
// FILE: c.kt
|
|
package a
|
|
|
|
public fun invalidFun0() {}
|
|
|
|
public val invalidProp0 = 1
|