[FE 1.0] Don't throw exception during substitution of accessors, just return original

This commit is contained in:
Victor Petukhov
2022-06-21 14:49:04 +02:00
committed by teamcity
parent db54d18c72
commit 00d1e46c5a
14 changed files with 254 additions and 1 deletions
@@ -0,0 +1,45 @@
// FIR_IDENTICAL
// WITH_STDLIB
interface FirJavaClass2 {
val superTypeRefs: MutableList<FirTypeRef2>
}
interface ConeKotlinType2
class ClassId2
val ConeKotlinType2.classId: ClassId2? get() = null
interface FirSignatureEnhancement2 {
fun enhanceSuperType(type: FirTypeRef2): FirTypeRef2 = TODO()
}
interface FirTypeRef2
val FirTypeRef2.coneType: ConeKotlinType2 get() = TODO()
private fun FirJavaClass2.getPurelyImplementedSupertype(): ConeKotlinType2? = null
inline fun buildResolvedTypeRef2(init: FirResolvedTypeRefBuilder2.() -> Unit): FirResolvedTypeRef2 = TODO()
interface FirResolvedTypeRef2 : FirTypeRef2
class FirResolvedTypeRefBuilder2 {
lateinit var type: ConeKotlinType2
}
fun foo(firJavaClass: FirJavaClass2, enhancement: FirSignatureEnhancement2) {
val enhancedSuperTypes = buildList {
val purelyImplementedSupertype = firJavaClass.getPurelyImplementedSupertype()
val purelyImplementedSupertypeClassId = purelyImplementedSupertype?.classId
firJavaClass.superTypeRefs.mapNotNullTo(this) { superType ->
enhancement.enhanceSuperType(superType).takeUnless {
purelyImplementedSupertypeClassId != null && it.coneType.classId == purelyImplementedSupertypeClassId
}
}
purelyImplementedSupertype?.let {
add(buildResolvedTypeRef2 { type = it })
}
}
}
@@ -0,0 +1,54 @@
package
public val ConeKotlinType2.classId: ClassId2?
public val FirTypeRef2.coneType: ConeKotlinType2
public inline fun buildResolvedTypeRef2(/*0*/ init: FirResolvedTypeRefBuilder2.() -> kotlin.Unit): FirResolvedTypeRef2
public fun foo(/*0*/ firJavaClass: FirJavaClass2, /*1*/ enhancement: FirSignatureEnhancement2): kotlin.Unit
private fun FirJavaClass2.getPurelyImplementedSupertype(): ConeKotlinType2?
public final class ClassId2 {
public constructor ClassId2()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface ConeKotlinType2 {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface FirJavaClass2 {
public abstract val superTypeRefs: kotlin.collections.MutableList<FirTypeRef2>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface FirResolvedTypeRef2 : FirTypeRef2 {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class FirResolvedTypeRefBuilder2 {
public constructor FirResolvedTypeRefBuilder2()
public final lateinit var type: ConeKotlinType2
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface FirSignatureEnhancement2 {
public open fun enhanceSuperType(/*0*/ type: FirTypeRef2): FirTypeRef2
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface FirTypeRef2 {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}