FIR u/s scope: choose most specific intersection member for override check
Before this commit we took just first intersection member for this check. However it's quite bad, because we were dependent on supertype order. Choosing the most specific member looks more consistent here. #KT-50969 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
1137e61fc8
commit
05d65275bf
+2
-2
@@ -27,8 +27,8 @@ abstract class Impl : Base {
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
abstract <!RETURN_TYPE_MISMATCH_ON_INHERITANCE!>class ImplDerived<!> : Impl(), Derived {
|
||||
abstract <!NOTHING_TO_OVERRIDE!>override<!> fun foo(name: String?): Derived
|
||||
abstract class ImplDerived : Impl(), Derived {
|
||||
abstract override fun foo(name: String?): Derived
|
||||
}
|
||||
|
||||
abstract class DerivedImpl : Derived, Impl() {
|
||||
|
||||
Vendored
-1
@@ -1,6 +1,5 @@
|
||||
ImplDerived:
|
||||
[Source]: public abstract override fun foo(name: R|kotlin/String?|): R|Derived| from Use site scope of /ImplDerived [id: 0]
|
||||
[IntersectionOverride]: public open fun foo(name: R|ft<kotlin/String, kotlin/String?>|): R|@EnhancedNullability Derived| from Use site scope of /ImplDerived [id: 0]
|
||||
[Source]: public open override fun foo(name: R|kotlin/String|): R|Base| from Use site scope of /Impl [id: 1]
|
||||
[Enhancement]: public abstract fun foo(name: R|@EnhancedNullability kotlin/String|): R|ft<Base, Base?>| from Java enhancement scope for /Base [id: 2]
|
||||
[Enhancement]: public abstract fun foo(name: R|ft<kotlin/String, kotlin/String?>|): R|@EnhancedNullability Derived| from Java enhancement scope for /Derived [id: 3]
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ abstract class AbstractFirUseSiteMemberScope(
|
||||
*
|
||||
* TODO: is it enough to check only one function?
|
||||
*/
|
||||
firstMember
|
||||
mostSpecific
|
||||
} else {
|
||||
chosenSymbol
|
||||
}
|
||||
|
||||
+2
-2
@@ -73,8 +73,8 @@ class FirTypeIntersectionScopeContext(
|
||||
).member as D
|
||||
}
|
||||
|
||||
val firstMember: D
|
||||
get() = context.extractedOverrides.first().member
|
||||
val mostSpecific: D
|
||||
get() = context.mostSpecific
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user