FIR declaration transformer: unwrap synthetic property accessor properly
This commit is contained in:
+25
-2
@@ -13,17 +13,40 @@ public interface Psi<D> {
|
||||
// FILE: Member.java
|
||||
|
||||
public interface Member<D> extends Psi<D> {
|
||||
}
|
||||
|
||||
// FILE: TypeParametersOwner.java
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TypeParametersOwner {
|
||||
public List<String> getTypeParameters();
|
||||
}
|
||||
|
||||
// FILE: Klass.java
|
||||
|
||||
public interface Klass extends TypeParametersOwner {
|
||||
}
|
||||
|
||||
// FILE: Test.kt
|
||||
|
||||
public interface Light
|
||||
fun List<String>.single(): String = ""
|
||||
fun List<Int>.single(): Int = 2
|
||||
|
||||
public class LightMember<D> : Light, Member<D> {
|
||||
fun listOf(): List<String> {}
|
||||
|
||||
public class LightMember<D> : Member<D>, Light() {
|
||||
override fun getName(): String = "Light"
|
||||
}
|
||||
|
||||
public class LightClassWrapper : Light(), Klass {
|
||||
fun test() = typeParameters.single()
|
||||
}
|
||||
|
||||
public abstract class Light : Field, TypeParametersOwner {
|
||||
fun getTypeParameters() = listOf()
|
||||
}
|
||||
|
||||
public interface Field : Named
|
||||
|
||||
public class LightField<D> : LightMember<Any>(), Field {
|
||||
|
||||
+29
-3
@@ -1,15 +1,41 @@
|
||||
FILE: Test.kt
|
||||
public abstract interface Light : R|kotlin/Any| {
|
||||
public final fun R|kotlin/collections/List<kotlin/String>|.single(): R|kotlin/String| {
|
||||
^single String()
|
||||
}
|
||||
public final class LightMember<D> : R|Light|, R|Member<D>| {
|
||||
public final fun R|kotlin/collections/List<kotlin/Int>|.single(): R|kotlin/Int| {
|
||||
^single Int(2)
|
||||
}
|
||||
public final fun listOf(): R|kotlin/collections/List<kotlin/String>| {
|
||||
}
|
||||
public final class LightMember<D> : R|Member<D>|, R|Light| {
|
||||
public constructor<D>(): R|LightMember<D>| {
|
||||
super<R|kotlin/Any|>()
|
||||
super<R|Light|>()
|
||||
}
|
||||
|
||||
public final override fun getName(): R|kotlin/String| {
|
||||
^getName String(Light)
|
||||
}
|
||||
|
||||
}
|
||||
public final class LightClassWrapper : R|Light|, R|Klass| {
|
||||
public constructor(): R|LightClassWrapper| {
|
||||
super<R|Light|>()
|
||||
}
|
||||
|
||||
public final fun test(): R|kotlin/String| {
|
||||
^test this@R|/LightClassWrapper|.R|/Light.typeParameters|.R|/single|()
|
||||
}
|
||||
|
||||
}
|
||||
public abstract class Light : R|Field|, R|TypeParametersOwner| {
|
||||
public constructor(): R|Light| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun getTypeParameters(): R|kotlin/collections/List<kotlin/String>| {
|
||||
^getTypeParameters R|/listOf|()
|
||||
}
|
||||
|
||||
}
|
||||
public abstract interface Field : R|Named| {
|
||||
}
|
||||
|
||||
+8
-1
@@ -97,7 +97,14 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
|
||||
|
||||
override fun transformProperty(property: FirProperty, data: ResolutionMode): CompositeTransformResult<FirProperty> {
|
||||
if (property is FirSyntheticProperty) {
|
||||
transformSimpleFunction(property.getter.delegate, data)
|
||||
val delegate = property.getter.delegate
|
||||
if (delegate.origin == FirDeclarationOrigin.IntersectionOverride) {
|
||||
val unwrapped = delegate.symbol.overriddenSymbol!!.fir
|
||||
transformSimpleFunction(unwrapped, data)
|
||||
delegate.replaceReturnTypeRef(unwrapped.returnTypeRef)
|
||||
} else {
|
||||
transformSimpleFunction(delegate, data)
|
||||
}
|
||||
return property.compose()
|
||||
}
|
||||
return withTypeParametersOf(property) {
|
||||
|
||||
Reference in New Issue
Block a user