No override check in FirClassUseSiteScope, fix nasty substitution bug

This fixes MPP override test
(see mppFakeOverride in FirMultiModuleResolveTestGenerated)
This commit is contained in:
Mikhail Glukhikh
2019-03-07 17:24:19 +03:00
parent de14dd1b9f
commit f5e2cd2ac4
11 changed files with 25 additions and 14 deletions
@@ -37,7 +37,7 @@ class FirClassSubstitutionScope(
}
private fun ConeKotlinType.substitute(): ConeKotlinType? {
if (this is ConeTypeParameterType) return substitution[this]
if (this is ConeTypeParameterType) return substitution[lookupTag]
val newArguments by lazy { arrayOfNulls<ConeKotlinTypeProjection>(typeArguments.size) }
var initialized = false
@@ -72,7 +72,7 @@ class FirClassUseSiteScope(
val self = (this as AbstractFirBasedSymbol<*>).fir as FirCallableMember
val overriding = seen.firstOrNull {
val member = (it as AbstractFirBasedSymbol<*>).fir as FirCallableMember
member.isOverride && self.modality != Modality.FINAL
self.modality != Modality.FINAL
&& sameReceivers(member.receiverTypeRef, self.receiverTypeRef)
&& similarFunctionsOrBothProperties(member, self)
} // TODO: two or more overrides for one fun?
+1 -1
View File
@@ -8,7 +8,7 @@ open class A {
class B : A() {
override fun foo(): B = this
fun bar(): B = this // Ambiguity, no override here
fun bar(): B = this // Ambiguity, no override here (really it's just "missing override" and no ambiguity)
override fun buz(p: B): B = this //No override as B <!:> A
fun test() {
+1 -1
View File
@@ -32,7 +32,7 @@ FILE: simple.kt
public final function test(): R|kotlin/Unit| {
R|/B.foo|()
<Ambiguity: bar, [/B.bar, /A.bar]>#()
R|/B.bar|()
<Ambiguity: buz, [/B.buz, /A.buz]>#()
}
@@ -15,7 +15,7 @@ FILE: simpleFakeOverride.kt
public constructor(): super<R|A<Some>|>()
public final function test(): R|kotlin/Unit| {
R|FakeOverride</A.foo: R|T|>|(<Unresolved name: Some>#())
R|FakeOverride</A.foo: R|Some|>|(<Unresolved name: Some>#())
}
}