[FIR] Support captured type arguments of anonymous objects in resolve
This commit is contained in:
@@ -78,8 +78,8 @@ fun FirRegularClass.defaultType(): ConeClassLikeTypeImpl {
|
||||
)
|
||||
}
|
||||
|
||||
fun FirAnonymousObject.defaultType(): ConeClassLikeTypeImpl {
|
||||
return ConeClassLikeTypeImpl(
|
||||
fun FirAnonymousObject.defaultType(): ConeClassLikeType {
|
||||
return this.typeRef.coneTypeSafe() ?: ConeClassLikeTypeImpl(
|
||||
symbol.toLookupTag(),
|
||||
emptyArray(),
|
||||
isNullable = false
|
||||
|
||||
+5
-3
@@ -369,9 +369,11 @@ class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransformer)
|
||||
}
|
||||
dataFlowAnalyzer.enterClass()
|
||||
val type = anonymousObject.defaultType()
|
||||
anonymousObject.resultType = buildResolvedTypeRef {
|
||||
source = anonymousObject.source
|
||||
this.type = type
|
||||
if (anonymousObject.typeRef !is FirResolvedTypeRef) {
|
||||
anonymousObject.resultType = buildResolvedTypeRef {
|
||||
source = anonymousObject.source
|
||||
this.type = type
|
||||
}
|
||||
}
|
||||
var result = withLabelAndReceiverType(null, anonymousObject, type) {
|
||||
transformDeclarationContent(anonymousObject, data).single as FirAnonymousObject
|
||||
|
||||
@@ -200,11 +200,11 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
||||
//require(this is ConeSymbol)
|
||||
return when (this) {
|
||||
is FirTypeParameterSymbol,
|
||||
is FirAnonymousObjectSymbol,
|
||||
is ConeCapturedTypeConstructor,
|
||||
is ErrorTypeConstructor,
|
||||
is ConeTypeVariableTypeConstructor,
|
||||
is ConeIntersectionType -> 0
|
||||
is FirAnonymousObjectSymbol -> fir.typeParameters.size
|
||||
is FirRegularClassSymbol -> fir.typeParameters.size
|
||||
is FirTypeAliasSymbol -> fir.typeParameters.size
|
||||
is ConeIntegerLiteralType -> 0
|
||||
@@ -216,6 +216,7 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
||||
//require(this is ConeSymbol)
|
||||
return when (this) {
|
||||
is FirTypeParameterSymbol -> error("?!:11")
|
||||
is FirAnonymousObjectSymbol -> fir.typeParameters[index].symbol
|
||||
is FirRegularClassSymbol -> fir.typeParameters[index].symbol
|
||||
is FirTypeAliasSymbol -> fir.typeParameters[index].symbol
|
||||
else -> error("?!:12")
|
||||
|
||||
Reference in New Issue
Block a user