FIR supertype resolve: decrease priority of type parameter scope

This commit is contained in:
Mikhail Glukhikh
2019-10-23 10:42:52 +03:00
parent 634f324f51
commit e28d41aa61
2 changed files with 6 additions and 6 deletions
@@ -43,12 +43,12 @@ abstract class FirAbstractTreeTransformerWithSuperTypes(
.asReversed().mapTo(towerScope.scopes) { .asReversed().mapTo(towerScope.scopes) {
nestedClassifierScope(it.lookupTag.classId, session) nestedClassifierScope(it.lookupTag.classId, session)
} }
regularClass.addTypeParametersScope()
val companionObjects = regularClass.declarations.filterIsInstance<FirRegularClass>().filter { it.isCompanion } val companionObjects = regularClass.declarations.filterIsInstance<FirRegularClass>().filter { it.isCompanion }
for (companionObject in companionObjects) { for (companionObject in companionObjects) {
towerScope.scopes += nestedClassifierScope(companionObject) towerScope.scopes += nestedClassifierScope(companionObject)
} }
towerScope.scopes += nestedClassifierScope(regularClass) towerScope.scopes += nestedClassifierScope(regularClass)
regularClass.addTypeParametersScope()
transformElement(regularClass, data) transformElement(regularClass, data)
} }
@@ -13,10 +13,10 @@ FILE: typeParameterVsNested.kt
} }
public abstract val x: R|T| public abstract val x: R|test/My.T|
public get(): R|T| public get(): R|test/My.T|
public abstract fun foo(arg: R|T|): R|kotlin/Unit| public abstract fun foo(arg: R|test/My.T|): R|kotlin/Unit|
public abstract val y: R|test/My.T| public abstract val y: R|test/My.T|
public get(): R|test/My.T| public get(): R|test/My.T|
@@ -24,9 +24,9 @@ FILE: typeParameterVsNested.kt
public abstract val z: R|test/My.T| public abstract val z: R|test/My.T|
public get(): R|test/My.T| public get(): R|test/My.T|
public final class Some : R|class error: Type parameter cannot be a super-type: T| { public final class Some : R|test/My.T| {
public constructor(): R|test/My.Some| { public constructor(): R|test/My.Some| {
super<R|T|>() super<R|test/My.T|>()
} }
} }