FIR: Fix special members came from superclass

class JavaSuperClass {
  // members impls with special signature, but it doesn't override any Kotlin specials
}

class KotlinInterface {
   // special members
}

class JavaSubClass extends JavaSuperClass implements KotlinInterface {
   // we should obtain members from JavaSuperClass with their Kotlinish
   // signature, not the Java one
}
This commit is contained in:
Denis.Zharkov
2022-04-21 11:43:46 +03:00
committed by teamcity
parent a0c92db819
commit bf96abeed1
3 changed files with 24 additions and 31 deletions
@@ -1,33 +1,24 @@
SomeMap:
[Enhancement]: public abstract fun containsKey(key: R|ft<K3, K3?>|): R|kotlin/Boolean| from Java enhancement scope for /SomeMap [id: 0]
[SubstitutionOverride]: public abstract fun containsKey(key: R|ft<K3, K3?>|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/MutableMap] for type SomeMap<K3, V3> [id: 1]
[Enhancement]: public abstract fun containsKey(key: R|ft<K3 & Any, K3?>|): R|kotlin/Boolean| from Java enhancement scope for /SomeMap [id: 0]
[SubstitutionOverride]: public abstract fun containsKey(key: R|ft<K3 & Any, K3?>|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/MutableMap] for type SomeMap<K3, V3> [id: 1]
[SubstitutionOverride]: public abstract fun containsKey(key: R|K|): R|kotlin/Boolean| from Use site scope of kotlin/collections/MutableMap [id: 2]
[Library]: public abstract fun containsKey(key: R|K|): R|kotlin/Boolean| from Use site scope of kotlin/collections/Map [id: 3]
[Library]: public abstract fun containsKey(key: R|K|): R|kotlin/Boolean| from Use site scope of kotlin/collections/Map [id: 3]
[SubstitutionOverride]: public abstract fun containsKey(key: R|ft<kotlin/Any, kotlin/Any?>|): R|kotlin/Boolean| from Substitution scope for [Java enhancement scope for /MyMap] for type SomeMap<K3, V3> [id: 4]
[Enhancement]: public abstract fun containsKey(key: R|ft<kotlin/Any, kotlin/Any?>|): R|kotlin/Boolean| from Java enhancement scope for /MyMap [id: 5]
[SubstitutionOverride]: public abstract fun containsKey(key: R|ft<kotlin/Any, kotlin/Any?>|): R|kotlin/Boolean| from Substitution scope for [Java enhancement scope for /MyBaseMap] for type MyMap<K2, V2> [id: 6]
[Enhancement]: public abstract fun containsKey(key: R|ft<kotlin/Any, kotlin/Any?>|): R|kotlin/Boolean| from Java enhancement scope for /MyBaseMap [id: 7]
[SubstitutionOverride]: public abstract fun containsKey(key: R|ft<kotlin/Any, kotlin/Any?>|): R|kotlin/Boolean| from Substitution scope for [Java enhancement scope for /MyBaseMap] for type MyMap<K2, V2> [id: 6]
[Enhancement]: public abstract fun containsKey(key: R|ft<kotlin/Any, kotlin/Any?>|): R|kotlin/Boolean| from Java enhancement scope for /MyBaseMap [id: 7]
[IntersectionOverride]: public abstract fun containsValue(value: R|ft<V3, V3?>|): R|kotlin/Boolean| from Java enhancement scope for /SomeMap [id: 0]
[SubstitutionOverride]: public abstract fun containsValue(value: R|ft<V3, V3?>|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/MutableMap] for type SomeMap<K3, V3> [id: 1]
[SubstitutionOverride]: public abstract fun containsValue(value: R|V|): R|kotlin/Boolean| from Use site scope of kotlin/collections/MutableMap [id: 2]
[Library]: public abstract fun containsValue(value: R|V|): R|kotlin/Boolean| from Use site scope of kotlin/collections/Map [id: 3]
[Library]: public abstract fun containsValue(value: R|V|): R|kotlin/Boolean| from Use site scope of kotlin/collections/Map [id: 3]
[SubstitutionOverride]: public abstract fun containsValue(key: R|ft<kotlin/Any, kotlin/Any?>|): R|kotlin/Boolean| from Substitution scope for [Java enhancement scope for /MyMap] for type SomeMap<K3, V3> [id: 4]
[Enhancement]: public abstract fun containsValue(key: R|ft<kotlin/Any, kotlin/Any?>|): R|kotlin/Boolean| from Java enhancement scope for /MyMap [id: 5]
[IntersectionOverride]: public abstract operator fun get(key: R|ft<K3, K3?>|): R|V3?| from Java enhancement scope for /SomeMap [id: 0]
[SubstitutionOverride]: public abstract operator fun get(key: R|ft<K3, K3?>|): R|V3?| from Substitution scope for [Use site scope of kotlin/collections/MutableMap] for type SomeMap<K3, V3> [id: 1]
[SubstitutionOverride]: public abstract fun containsValue(value: R|ft<V3 & Any, V3?>|): R|kotlin/Boolean| from Java enhancement scope for /SomeMap [id: 0]
[SubstitutionOverride]: public abstract fun containsValue(value: R|V|): R|kotlin/Boolean| from Use site scope of kotlin/collections/MutableMap [id: 1]
[Library]: public abstract fun containsValue(value: R|V|): R|kotlin/Boolean| from Use site scope of kotlin/collections/Map [id: 2]
[Library]: public abstract fun containsValue(value: R|V|): R|kotlin/Boolean| from Use site scope of kotlin/collections/Map [id: 2]
[IntersectionOverride]: public abstract operator fun get(key: R|ft<K3 & Any, K3?>|): R|V3?| from Java enhancement scope for /SomeMap [id: 0]
[SubstitutionOverride]: public abstract operator fun get(key: R|ft<K3 & Any, K3?>|): R|V3?| from Substitution scope for [Use site scope of kotlin/collections/MutableMap] for type SomeMap<K3, V3> [id: 1]
[SubstitutionOverride]: public abstract operator fun get(key: R|K|): R|V?| from Use site scope of kotlin/collections/MutableMap [id: 2]
[Library]: public abstract operator fun get(key: R|K|): R|V?| from Use site scope of kotlin/collections/Map [id: 3]
[Library]: public abstract operator fun get(key: R|K|): R|V?| from Use site scope of kotlin/collections/Map [id: 3]
[SubstitutionOverride]: public abstract operator fun get(key: R|ft<K3, K3?>|): R|ft<V3, V3?>| from Substitution scope for [Java enhancement scope for /MyMap] for type SomeMap<K3, V3> [id: 4]
[Enhancement]: public abstract operator fun get(key: R|ft<K2, K2?>|): R|ft<V2, V2?>| from Java enhancement scope for /MyMap [id: 5]
[Enhancement]: public abstract fun remove(key: R|ft<K3, K3?>|): R|V3?| from Java enhancement scope for /SomeMap [id: 0]
[SubstitutionOverride]: public abstract fun remove(key: R|ft<K3, K3?>|): R|V3?| from Substitution scope for [Use site scope of kotlin/collections/MutableMap] for type SomeMap<K3, V3> [id: 1]
[SubstitutionOverride]: public abstract operator fun get(key: R|ft<K3 & Any, K3?>|): R|ft<V3 & Any, V3?>| from Substitution scope for [Java enhancement scope for /MyMap] for type SomeMap<K3, V3> [id: 4]
[Enhancement]: public abstract operator fun get(key: R|ft<K2 & Any, K2?>|): R|ft<V2 & Any, V2?>| from Java enhancement scope for /MyMap [id: 5]
[Enhancement]: public abstract fun remove(key: R|ft<K3 & Any, K3?>|): R|V3?| from Java enhancement scope for /SomeMap [id: 0]
[SubstitutionOverride]: public abstract fun remove(key: R|ft<K3 & Any, K3?>|): R|V3?| from Substitution scope for [Use site scope of kotlin/collections/MutableMap] for type SomeMap<K3, V3> [id: 1]
[Library]: public abstract fun remove(key: R|K|): R|V?| from Use site scope of kotlin/collections/MutableMap [id: 2]
[SubstitutionOverride]: public open fun remove(key: R|ft<K3, K3?>|, value: R|ft<V3, V3?>|): R|kotlin/Boolean| from Java enhancement scope for /SomeMap [id: 0]
[SubstitutionOverride]: public open fun remove(key: R|ft<K3 & Any, K3?>|, value: R|ft<V3 & Any, V3?>|): R|kotlin/Boolean| from Java enhancement scope for /SomeMap [id: 0]
[Library]: public open fun remove(key: R|K|, value: R|V|): R|kotlin/Boolean| from Use site scope of kotlin/collections/MutableMap [id: 1]
MyMap:
@@ -35,5 +26,5 @@ MyMap:
[SubstitutionOverride]: public abstract fun containsKey(key: R|ft<kotlin/Any, kotlin/Any?>|): R|kotlin/Boolean| from Substitution scope for [Java enhancement scope for /MyBaseMap] for type MyMap<K2, V2> [id: 1]
[Enhancement]: public abstract fun containsKey(key: R|ft<kotlin/Any, kotlin/Any?>|): R|kotlin/Boolean| from Java enhancement scope for /MyBaseMap [id: 2]
[Enhancement]: public abstract fun containsValue(key: R|ft<kotlin/Any, kotlin/Any?>|): R|kotlin/Boolean| from Java enhancement scope for /MyMap [id: 0]
[Enhancement]: public abstract operator fun get(key: R|ft<K2, K2?>|): R|ft<V2, V2?>| from Java enhancement scope for /MyMap [id: 0]
[Enhancement]: public abstract operator fun get(key: R|ft<K2 & Any, K2?>|): R|ft<V2 & Any, V2?>| from Java enhancement scope for /MyMap [id: 0]
@@ -378,7 +378,9 @@ class JavaClassUseSiteMemberScope(
// regular rules
when (explicitlyDeclaredFunctionWithNaturalName) {
null -> {
destination += resultOfIntersectionWithNaturalName.chosenSymbol
val chosenSymbol = resultOfIntersectionWithNaturalName.chosenSymbol
if (!chosenSymbol.isVisibleInCurrentClass()) continue
destination += chosenSymbol
resultsOfIntersectionToSaveInCache += resultOfIntersectionWithNaturalName
}
else -> {
@@ -25,15 +25,15 @@ class K2 : JavaClass() {
}
class K3 : JavaClass() {
override fun foo(x: Int, y: Continuation<String>): Any? = null
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(x: Int, y: Continuation<String>): Any? = null
}
fun builder(block: suspend () -> Unit) {}
fun main(x: Continuation<String>) {
JavaClass().foo(5, x)
K1().foo(6, x)
K2().foo(7, x)
JavaClass().foo(5, <!TOO_MANY_ARGUMENTS!>x<!>)
K1().foo(6, <!TOO_MANY_ARGUMENTS!>x<!>)
K2().foo(7, <!TOO_MANY_ARGUMENTS!>x<!>)
K3().foo(8, x)
builder {
@@ -42,9 +42,9 @@ fun main(x: Continuation<String>) {
K2().foo(3)
K3().foo(4)
JavaClass().foo(5, x)
K1().foo(6, x)
K2().foo(7, x)
JavaClass().foo(5, <!TOO_MANY_ARGUMENTS!>x<!>)
K1().foo(6, <!TOO_MANY_ARGUMENTS!>x<!>)
K2().foo(7, <!TOO_MANY_ARGUMENTS!>x<!>)
K3().foo(8, x)
}
}